Opened 4 years ago

Closed 4 years ago

#4532 closed defect (invalid)

3.0.0rc1 build failure on Ubuntu xenial: gserialized_estimate.o: undefined reference to symbol 'roundf@@GLIBC_2.2.5'

Reported by: myon Owned by: pramsey
Priority: blocker Milestone: PostGIS 3.0.0
Component: postgis Version: master
Keywords: Cc:

Description

3.0.0rc1 fails on Ubuntu xenial, all architectures covered by apt.postgresql.org. (Other Debian/Ubuntu distributions build fine.)

amd64:

13:27:23 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -pie -fno-omit-frame-pointer -fPIC -shared -o postgis-3.so postgis_module.o lwgeom_accum.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o lwgeom_inout.o lwgeom_functions_basic.o lwgeom_btree.o lwgeom_box.o lwgeom_box3d.o lwgeom_geos.o lwgeom_sfcgal.o lwgeom_geos_prepared.o lwgeom_geos_clean.o lwgeom_geos_relatematch.o lwgeom_export.o lwgeom_in_gml.o lwgeom_in_kml.o lwgeom_in_geohash.o lwgeom_in_geojson.o lwgeom_in_encoded_polyline.o lwgeom_triggers.o lwgeom_dump.o lwgeom_dumppoints.o lwgeom_functions_lrs.o lwgeom_functions_temporal.o lwgeom_rectree.o long_xact.o lwgeom_sqlmm.o lwgeom_rtree.o lwgeom_transform.o lwgeom_window.o gserialized_typmod.o gserialized_gist_2d.o gserialized_gist_nd.o gserialized_supportfn.o gserialized_spgist_2d.o gserialized_spgist_3d.o gserialized_spgist_nd.o brin_2d.o brin_nd.o brin_common.o gserialized_estimate.o geography_inout.o geography_btree.o geography_centroid.o geography_measurement.o geography_measurement_trees.o geometry_inout.o postgis_libprotobuf.o vector_tile.pb-c.o geobuf.pb-c.o mvt.o lwgeom_out_mvt.o geobuf.o lwgeom_out_geobuf.o lwgeom_out_geojson.o postgis_legacy.o -L/usr/lib/x86_64-linux-gnu  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/llvm-6.0/lib  -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed  ../deps/wagyu/libwagyu.la -lstdc++ ../libpgcommon/libpgcommon.a ../liblwgeom/.libs/liblwgeom.a  -L/usr/lib/x86_64-linux-gnu -lgeos_c -lproj -ljson-c -lprotobuf-c -lxml2 -L/usr/lib/x86_64-linux-gnu -lSFCGAL -Wl,--exclude-libs,ALL -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -L/usr/lib/x86_64-linux-gnu -lSFCGAL 
13:27:24 /usr/bin/ld: gserialized_estimate.o: undefined reference to symbol 'roundf@@GLIBC_2.2.5'
13:27:24 //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
13:27:24 collect2: error: ld returned 1 exit status
13:27:24 /usr/lib/postgresql/11/lib/pgxs/src/makefiles/../../src/Makefile.shlib:309: recipe for target 'postgis-3.so' failed

i386 (and ppc64el):

13:29:32 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -pie -fPIC -shared -o postgis-3.so postgis_module.o lwgeom_accum.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o lwgeom_inout.o lwgeom_functions_basic.o lwgeom_btree.o lwgeom_box.o lwgeom_box3d.o lwgeom_geos.o lwgeom_sfcgal.o lwgeom_geos_prepared.o lwgeom_geos_clean.o lwgeom_geos_relatematch.o lwgeom_export.o lwgeom_in_gml.o lwgeom_in_kml.o lwgeom_in_geohash.o lwgeom_in_geojson.o lwgeom_in_encoded_polyline.o lwgeom_triggers.o lwgeom_dump.o lwgeom_dumppoints.o lwgeom_functions_lrs.o lwgeom_functions_temporal.o lwgeom_rectree.o long_xact.o lwgeom_sqlmm.o lwgeom_rtree.o lwgeom_transform.o lwgeom_window.o gserialized_typmod.o gserialized_gist_2d.o gserialized_gist_nd.o gserialized_supportfn.o gserialized_spgist_2d.o gserialized_spgist_3d.o gserialized_spgist_nd.o brin_2d.o brin_nd.o brin_common.o gserialized_estimate.o geography_inout.o geography_btree.o geography_centroid.o geography_measurement.o geography_measurement_trees.o geometry_inout.o postgis_libprotobuf.o vector_tile.pb-c.o geobuf.pb-c.o mvt.o lwgeom_out_mvt.o geobuf.o lwgeom_out_geobuf.o lwgeom_out_geojson.o postgis_legacy.o -L/usr/lib/i386-linux-gnu  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/llvm-6.0/lib  -L/usr/lib/i386-linux-gnu/mit-krb5 -Wl,--as-needed  ../deps/wagyu/libwagyu.la -lstdc++ ../libpgcommon/libpgcommon.a ../liblwgeom/.libs/liblwgeom.a  -L/usr/lib/i386-linux-gnu -lgeos_c -lproj -ljson-c -lprotobuf-c -lxml2 -L/usr/lib/i386-linux-gnu -lSFCGAL -Wl,--exclude-libs,ALL -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -L/usr/lib/i386-linux-gnu -lSFCGAL 
13:29:32 /usr/bin/ld: ../liblwgeom/.libs/liblwgeom.a(measures.o): undefined reference to symbol 'hypot@@GLIBC_2.0'
13:29:32 //lib/i386-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
13:29:32 collect2: error: ld returned 1 exit status
13:29:32 /usr/lib/postgresql/11/lib/pgxs/src/makefiles/../../src/Makefile.shlib:309: recipe for target 'postgis-3.so' failed

Full logs: https://pgdgbuild.dus.dg-i.net/view/Binaries/job/postgis-binaries/241/architecture=amd64,distribution=xenial/console https://pgdgbuild.dus.dg-i.net/view/Binaries/job/postgis-binaries/architecture=i386,distribution=xenial/241/console

Change History (6)

comment:1 by Algunenano, 4 years ago

As liblwgeom is now linked statically we might need to explicitly add -lm to the libraries (postgis-3.so and so on). Can you test manually adding it to the LDFLAGS during configure, please?

comment:2 by Algunenano, 4 years ago

https://github.com/postgis/postgis/pull/491 might fix this issue.

All my systems were already working without the patch (including a Xenial VM) so it'd nice if you could confirm it before merging.

in reply to:  2 comment:3 by myon, 4 years ago

Replying to Algunenano:

All my systems were already working without the patch (including a Xenial VM) so it'd nice if you could confirm it before merging.

The difference might be that dpkg-buildpackage uses additional compiler flags compared to a "plain" build, cf. dpkg-buildflags. I'd especially suspect LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro to make a difference in this area.

comment:4 by Algunenano, 4 years ago

I can confirm that when I run the exact same command (removing sfcgal because I don't have it installed) in the Xenial VM I get the same error, so it looks it has to do with some linker options.

comment:5 by Algunenano, 4 years ago

The issue goes again once I remove the -pie flag. I'm not sure why it's there since it is used to produce executables, so I'm investigating where it comes from and what can we do to suppress it.

comment:6 by myon, 4 years ago

Resolution: invalid
Status: newclosed

This turned out to be my fault. We had previously disabled PIE on Ubuntu because it caused trouble, but then I removed that logic, neglecting the fact that it's still necessary.

https://salsa.debian.org/debian-gis-team/postgis/commit/50866f4d2d161515899ddf2e041dce3d52c03aba

I put it back now for xenial; bionic seems fine.

Note: See TracTickets for help on using tickets.