libretro / 81-libretro

A port of the EightyOne ZX81 Emulator to libretro
GNU General Public License v3.0
20 stars 30 forks source link

Fix multiple definition error when -fno-common #24

Closed guoyunhe closed 4 years ago

guoyunhe commented 4 years ago

In some system when -fno-common is the default gcc flag, it throws the following error:

/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ./src/libretro.o:(.data.rel.local+0x0): multiple definition of `log_cb'; ./src/coreopt.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status

To fix it, I add extern in the definition.

guoyunhe commented 4 years ago

@leiradel is it good now?

leiradel commented 4 years ago

Sorry, yes, it looks good.

guoyunhe commented 4 years ago

can you merge it?

inactive123 commented 4 years ago

Hi @guoyunhe ,

could you check if you would be able to find a way to fix the issues that started popping up with RetroArch and RDB files on GCC 10?

https://github.com/libretro/RetroArch/issues/10711

For all we know it might be a single compiler switch that has to be set in order for the issues to go away.

guoyunhe commented 4 years ago

@twinaphex it seems a different issue. I tried to add -fcommon but it doesn't work. (maybe I add it to wrong place)