Open agronick opened 4 years ago
Running configure LDFLAGS="-z muldefs" ./configure
worked for some reason.
It's a problem with gcc-10
.
gcc-10
fails if you have a global symbol defined in more than one source file, see https://gcc.gnu.org/gcc-10/porting_to.html
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
.
So the proper fix is to put the true globals into a header file and define them as extern
, while declaring all other variables as static
or moving them into the scope of functions.
I'm getting the following error during build. I don't know if its a bug or an issue with my system. Appreceate if anyone knows how to fix it.
When I try
LDFLAGS=--allow-multiple-definition
it says the c++ compiler isn't working.When I try with g++ I get this error:
Edit: So I can get rid of the errors here by renaming the variable
class
to_class
and by using-fpermissive
. After that I get the same errors I was getting on gcc.