Compilation fails with -fno-common or gcc 10, indicating missing "extern" declarations
When compiling dhcp with "-fno-common" in CFLAGS compilation will fail. This flag will be enabled by default in gcc 10.
This indicates that the global variables aren't properly declared as "extern". In the past gcc allowed sloppy declarations and e.g. having the same named global variable in two .c files linked together were handled as one variable. But this is not correct C, it needs to declare the global variable in one file and properly declare all other uses as extern.
Error message:
gcc -fno-common -I../includes -I/tmp/dhcp-4.4.2/bind/include -o dhclient client_tables.o clparse.o dhclient.o dhc6.o ../common/libdhcp.a ../omapip/libomapi.a /tmp/dhcp-4.4.2/bind/bind-9.11.14/lib/irs/libirs.a /tmp/dhcp-4.4.2/bind/bind-9.11.14/lib/dns/libdns.a /tmp/dhcp-4.4.2/bind/bind-9.11.14/lib/isccfg/libisccfg.a /tmp/dhcp-4.4.2/bind/bind-9.11.14/lib/isc/libisc.a
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../common/libdhcp.a(discover.o):(.bss+0x20): multiple definition of `local_port'; dhclient.o:(.bss+0x74): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../common/libdhcp.a(discover.o):(.bss+0x22): multiple definition of `remote_port'; dhclient.o:(.bss+0x76): first defined here