Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4667 closed defect (fixed)

Fails to build with GCC-10

Reported by: sebastic Owned by: Algunenano
Priority: medium Milestone:
Component: build Version: 3.0.x
Keywords: Cc:

Description

As reported by Matthias Klose in Debian Bug #957699:

The package fails to build in a test rebuild on at least amd64 with gcc-10/g++-10, but succeeds to build with gcc-9/g++-9. The severity of this report will be raised before the bullseye release, so nothing has to be done for the buster release.

The full build log can be found at: http://people.debian.org/~doko/logs/gcc10-20200225/postgis_3.0.1+dfsg-1_unstable_gcc10.log The last lines of the build log are at the end of this report.

To build with GCC 10, either set CC=gcc-10 CXX=g++-10 explicitly, or install the gcc, g++, gfortran, … packages from experimental.

  apt-get -t=experimental install g++ 

Common build failures are new warnings resulting in build failures with -Werror turned on, or new/dropped symbols in Debian symbols files. For other C/C++ related build failures see the porting guide at http://gcc.gnu.org/gcc-10/porting_to.html

[...]
make -C cunit check
make[4]: Entering directory '/<<PKGBUILDDIR>>/libpgcommon/cunit'
make[4]: Nothing to be done for 'check'.
make[4]: Leaving directory '/<<PKGBUILDDIR>>/libpgcommon/cunit'
make[3]: Leaving directory '/<<PKGBUILDDIR>>/libpgcommon'
---- Making check-unit in postgis
make[3]: Entering directory '/<<PKGBUILDDIR>>/postgis'
make[3]: Nothing to be done for 'check-unit'.
make[3]: Leaving directory '/<<PKGBUILDDIR>>/postgis'
---- Making check-unit in regress
make[3]: Entering directory '/<<PKGBUILDDIR>>/regress'
make[3]: Nothing to be done for 'check-unit'.
make[3]: Leaving directory '/<<PKGBUILDDIR>>/regress'
---- Making check-unit in raster
make[3]: Entering directory '/<<PKGBUILDDIR>>/raster'
make -C test check-unit
make[4]: Entering directory '/<<PKGBUILDDIR>>/raster/test'
make -C cunit check
make[5]: Entering directory '/<<PKGBUILDDIR>>/raster/test/cunit'
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_pixtype.o cu_pixtype.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_raster_basics.o cu_raster_basics.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_band_basics.o cu_band_basics.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_raster_wkb.o cu_raster_wkb.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_raster_geometry.o cu_raster_geometry.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_raster_misc.o cu_raster_misc.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_band_stats.o cu_band_stats.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_band_misc.o cu_band_misc.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_gdal.o cu_gdal.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_spatial_relationship.o cu_spatial_relationship.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_mapalgebra.o cu_mapalgebra.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_misc.o cu_misc.c
x86_64-linux-gnu-gcc -I.. -Wdate-time -D_FORTIFY_SOURCE=2  -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -c -o cu_tester.o cu_tester.c
/bin/bash ../../../libtool --mode=link x86_64-linux-gnu-gcc -I../../../liblwgeom -I../../rt_core  -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros  -o cu_tester cu_pixtype.o cu_raster_basics.o cu_band_basics.o cu_raster_wkb.o cu_raster_geometry.o cu_raster_misc.o cu_band_stats.o cu_band_misc.o cu_gdal.o cu_spatial_relationship.o cu_mapalgebra.o cu_misc.o cu_tester.o ../../rt_core/librtcore.a ../../../liblwgeom/.libs/liblwgeom.a -L/usr/lib -lgdal -L/usr/lib/x86_64-linux-gnu -lgeos_c -lproj -lm  -Wl,-z,relro -Wl,-z,now -lcunit
libtool: link: x86_64-linux-gnu-gcc -I../../../liblwgeom -I../../rt_core -I/usr/include/gdal -I/usr/include -Wall -Wmissing-prototypes -std=gnu99 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fno-math-errno -fno-signed-zeros -o cu_tester cu_pixtype.o cu_raster_basics.o cu_band_basics.o cu_raster_wkb.o cu_raster_geometry.o cu_raster_misc.o cu_band_stats.o cu_band_misc.o cu_gdal.o cu_spatial_relationship.o cu_mapalgebra.o cu_misc.o cu_tester.o -Wl,-z -Wl,relro -Wl,-z -Wl,now  ../../rt_core/librtcore.a ../../../liblwgeom/.libs/liblwgeom.a -L/usr/lib -lgdal -L/usr/lib/x86_64-linux-gnu -lgeos_c /usr/lib/x86_64-linux-gnu/libproj.so -lm -lcunit
/usr/bin/ld: cu_raster_basics.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_band_basics.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_raster_wkb.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_raster_geometry.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_raster_misc.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_band_stats.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_band_misc.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_gdal.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_spatial_relationship.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_mapalgebra.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_misc.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
/usr/bin/ld: cu_tester.o:./raster/test/cunit/cu_tester.h:21: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:21: first defined here
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:84: cu_tester] Error 1
make[5]: Leaving directory '/<<PKGBUILDDIR>>/raster/test/cunit'
make[4]: *** [Makefile:19: check-unit] Error 2
make[4]: Leaving directory '/<<PKGBUILDDIR>>/raster/test'
make[3]: *** [Makefile:66: check-unit] Error 2
make[3]: Leaving directory '/<<PKGBUILDDIR>>/raster'
make[2]: *** [GNUmakefile:20: check-unit] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
*** /tmp/pg_virtualenv.FPqNSR/log/postgresql-12-regress.log (last 100 lines) ***
2020-02-26 12:14:02.110 UTC [29435] LOG:  starting PostgreSQL 12.2 (Debian 12.2-1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 9.2.1-28) 9.2.1 20200203, 64-bit
2020-02-26 12:14:02.110 UTC [29435] LOG:  listening on IPv6 address "::1", port 5432
2020-02-26 12:14:02.110 UTC [29435] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2020-02-26 12:14:02.110 UTC [29435] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-02-26 12:14:02.119 UTC [29436] LOG:  database system was shut down at 2020-02-26 12:14:02 UTC
2020-02-26 12:14:02.122 UTC [29435] LOG:  database system is ready to accept connections
Dropping cluster 12/regress ...
Can't exec "/bin/ps": No such file or directory at /usr/share/perl5/PgCommon.pm line 613.
Error: Could not exec /bin/ps
Error: This cluster is still running. Stop it or supply the --stop option
make[1]: *** [debian/rules:181: override_dh_auto_test] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:84: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

Attachments (1)

postgis_3.1.0~alpha1+dfsg-1~exp3_amd64.build (512.8 KB ) - added by sebastic 5 years ago.
Buildlog with gcc-10

Download all attachments as: .zip

Change History (14)

comment:1 by Raúl Marín <git@…>, 5 years ago

In 8970075/git:

Raster cunit: Add missing guards

References #4667

comment:2 by Algunenano, 5 years ago

Owner: changed from strk to Algunenano

There was a missing guard in the included file, so it should be fixed with this.

Bas, I think this should fix the issue but I don't have gcc 10 available without compiling it. If you can confirm it fixes the issue I'll backport it to all stable releases.

comment:3 by sebastic, 5 years ago

With the changes from 8970075 added as patch, the package still fails to build with gcc from Debian experimental:

/usr/bin/ld: cu_raster_basics.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_band_basics.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_raster_wkb.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_raster_geometry.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_raster_misc.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_band_stats.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_band_misc.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_gdal.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_spatial_relationship.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_mapalgebra.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_misc.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
/usr/bin/ld: cu_tester.o:./raster/test/cunit/cu_tester.h:24: multiple definition of `cu_error_msg'; cu_pixtype.o:./raster/test/cunit/cu_tester.h:24: first defined here
collect2: error: ld returned 1 exit status

by sebastic, 5 years ago

Buildlog with gcc-10

comment:4 by Raúl Marín <git@…>, 5 years ago

In fed776a/git:

Raster cu_tester: Move cu_error_msg declaration to the source file

References #4667

comment:5 by Algunenano, 5 years ago

Thanks for testing it.

I've moved the string declaration to the source file which I hope fixes the issue. I did something similar a year ago to liblwgeom cunit tests and that isn't complaining, so I guess this should be ok too.

comment:6 by sebastic, 5 years ago

That also looks like what the porting guide documents:

Default to -fno-common

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

comment:7 by Algunenano, 5 years ago

Ok, with -fno-common I can reproduce it with both clang and gcc in older versions.

I've done a full build forcing that flag to be included (so it affects both pure postgis files and the ones using postgresql flags) and it seems to build fine after the last patch.

Once the tests pass I'll backport the patches to other stable branches.

comment:8 by sebastic, 5 years ago

With both patches, the package builds successfully with gcc from experimental.

comment:9 by Raúl Marín <git@…>, 5 years ago

In 72fc4cd/git:

Fix compilation errors with gcc 10

References #4667

comment:10 by Raúl Marín <git@…>, 5 years ago

In 0b47e35a/git:

Fix compilation errors with gcc 10

References #4667

comment:11 by Raúl Marín <git@…>, 5 years ago

In eca3164/git:

Fix compilation errors with gcc 10

References #4667

comment:12 by Raúl Marín <git@…>, 5 years ago

Resolution: fixed
Status: newclosed

In 9702b97/git:

Fix compilation errors with gcc 10

Closes #4667

comment:13 by Algunenano, 5 years ago

Everything looks green in master. Pushed to all branches. Thanks for the report!"

Note: See TracTickets for help on using tickets.