Bug 162

Summary: rmac does not compile with GCC 10
Product: RMAC Reporter: Thomas <frosties>
Component: CoreAssignee: Shamus Hammons <jlhamm>
Status: RESOLVED FIXED    
Severity: normal CC: ggnkua, jlhamm
Priority: Normal    
Version: unspecified   
Hardware: PC   
OS: Linux   
Attachments: Fix CFLAGS to add -fcommon in makefile
Better fix the code than add magic command lines methinks!

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!  :-)