You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#/tmp/ocesql-1.2b/build/ocesql> make
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -o ocesql errorfile.o ocesql.o ocesqlutil.o parser.o ppout.o scanner.o
libtool: link: gcc -g -O2 -o ocesql errorfile.o ocesql.o ocesqlutil.o parser.o ppout.o scanner.o
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:49: multiple definition of `dbname'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:40: first defined here
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:50: multiple definition of `prepname'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:41: first defined here
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:45: multiple definition of `host_reference_list'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:36: first defined here
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:46: multiple definition of `res_host_reference_list'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:37: first defined here
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:52: multiple definition of `cursorname'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:42: first defined here
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:47: multiple definition of `sql_list'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:38: first defined here
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:40: multiple definition of `hostlineno'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:32: first defined here
/usr/bin/ld: scanner.o:/tmp/ocesql-1.2b/build/ocesql/scanner.l:44: multiple definition of `exec_list'; ocesql.o:/tmp/ocesql-1.2b/ocesql/ocesql.c:39: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:425: ocesql] Error 1
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.
Both ocesql.c (which has this as external definition) and scanner.l (which includes the external one via ocesql.h) share those definitions with the same name. scanner.l has both "local" and "external" names that match to this.
So as a temporary workaround add CFLAGS=-fcommon if you need to compile a not-yet-fixed version of ocesql with a recent GCC; to reproduce the failure on the current CI: just add CFLAGS=-fno-common, to actually fix this: check if those should be shared or not, then adjust the code accordingly.
The text was updated successfully, but these errors were encountered:
The reason is documented in https://gcc.gnu.org/gcc-10/porting_to.html
Both ocesql.c (which has this as external definition) and scanner.l (which includes the external one via ocesql.h) share those definitions with the same name. scanner.l has both "local" and "external" names that match to this.
So as a temporary workaround add
CFLAGS=-fcommon
if you need to compile a not-yet-fixed version of ocesql with a recent GCC; to reproduce the failure on the current CI: just addCFLAGS=-fno-common
, to actually fix this: check if those should be shared or not, then adjust the code accordingly.The text was updated successfully, but these errors were encountered: