Bug 162 - rmac does not compile with GCC 10
Summary: rmac does not compile with GCC 10
Status: RESOLVED FIXED
Alias: None
Product: RMAC
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: PC Linux
: Normal normal
Assignee: Shamus Hammons
URL:
Depends on:
Blocks:
 
Reported: 2020-06-06 08:43 CDT by Thomas
Modified: 2020-07-04 10:55 CDT (History)
2 users (show)

See Also:


Attachments
Fix CFLAGS to add -fcommon in makefile (566 bytes, patch)
2020-06-06 08:43 CDT, Thomas
Details
Better fix the code than add magic command lines methinks! (5.00 KB, patch)
2020-06-07 11:32 CDT, ggn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas 2020-06-06 08:43:53 CDT
Created attachment 122 [details]
Fix CFLAGS to add -fcommon in makefile

Hello,

rmac does not compile with GCC 10. There are multiple errors like :
/usr/bin/ld: dsp56k_amode.o:(.bss+0x220): multiple definition of `nmodes'; amode.o:(.bss+0xf08): first defined here
/usr/bin/ld: dsp56k_mach.o:/home/thomas/git/0ldschool/rmac/dsp56k_amode.h:99: multiple definition of `dsp_a0reg'; dsp56k_amode.o:/home/thomas/git/0ldschool/rmac/dsp56k_amode.h:99: first defined here

A simple fix is to add the -fcommon in the CFLAGS. Like the attached patch. The GCC10 porting guide indicates to add an extern keyword in the definition of variables in header files: https://gcc.gnu.org/gcc-10/porting_to.html

Regards
Comment 1 Shamus Hammons 2020-06-06 10:41:04 CDT
Hmm, externed vars in header files should already be marked "extern"; if they aren't, then that's a bug that needs fixing.  Will have a look.
Comment 2 ggn 2020-06-07 11:32:59 CDT
Created attachment 123 [details]
Better fix the code than add magic command lines methinks!

Hi,

Since I also had the exact same problem on osx (see #157), I think it's a better idea to just fix the declarations, otherwise we're just going to end up with a more complex build system (and who wants that!)

Patch attached.
Comment 3 Thomas 2020-06-07 12:33:55 CDT
I agree, it was not the best to do. My C is rusty and I finally came to something looking like the patch supplied by ggn. Thanks !
Comment 4 Shamus Hammons 2020-07-04 10:55:05 CDT
Thanks for the patch!  :-)