Empire fails to build from source with GCC 10
GCC 10 defaults to -fno-common and empire will fail to build from source because of not using the extern keyword in extern.h. This leads to error messages like the following ones.
/usr/bin/ld: term.o:./extern.h:16: multiple definition of
delay_time'; attack.o:./extern.h:16: first defined here /usr/bin/ld: term.o:./extern.h:15: multiple definition of MIN_CITY_DIST'; attack.o:./extern.h:15: first defined here
/usr/bin/ld: term.o:./extern.h:14: multiple definition of `WATER_RATIO'; attack.o:./extern.h:14: first defined here
A workaround is to compile with -fcommon again.
Quote from the GCC 10 porting guide:
A common mistake in C is omitting extern when declaring a global variable in a header file. If the header is included by several files it results in multiple definitions of the same variable. In previous GCC versions this error is ignored. GCC 10 defaults to -fno-common, which means a linker error will now be reported. To fix this, use extern in header files when declaring global variables, and ensure each global is defined in exactly one C file. If tentative definitions of particular variables need to be placed in a common block, attribute((common)) can be used to force that behavior even in code compiled without -fcommon. As a workaround, legacy C code where all tentative definitions should be placed into a common block can be compiled with -fcommon.
int x; // tentative definition - avoid in header files extern int y; // correct declaration in a header file