fwknop fails to compile with -fno-common (the gcc-10+ default)
hlein opened this issue · comments
When -fno-common is enabled, linking fails with:
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: fwknop-config_init.o:(.bss+0x0): multiple definition of `log_level_t'; fwknop-fwknop.o:(.bss+0x0): first defined here /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: fwknop-spa_comm.o:(.bss+0x0): multiple definition of `log_level_t'; fwknop-fwknop.o:(.bss+0x0): first defined here /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: fwknop-utils.o:(.bss+0x0): multiple definition of `log_level_t'; fwknop-fwknop.o:(.bss+0x0): first defined here /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: fwknop-http_resolve_host.o:(.bss+0x0): multiple definition of `log_level_t'; fwknop-fwknop.o:(.bss+0x0): first defined here /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: fwknop-getpasswd.o:(.bss+0x0): multiple definition of `log_level_t'; fwknop-fwknop.o:(.bss+0x0): first defined here /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: fwknop-log_msg.o:(.bss+0x0): multiple definition of `lo g_level_t'; fwknop-fwknop.o:(.bss+0x0): first defined here
Tested with gcc-8 and gcc-9, with CFLAGS="-fno-common"
.
See also https://bugs.gentoo.org/706816 and https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
In fwknop's case the fix seems very small and simple; I'll make a PR with the fix.
@Jakuje 's fix is simpler: Jakuje@a87325b