Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 632354 - dev-db/postgis: link failures with ld.gold
Summary: dev-db/postgis: link failures with ld.gold
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PgSQL Bugs
URL: https://trac.osgeo.org/postgis/ticket...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-29 11:53 UTC by Michael Orlitzky
Modified: 2017-09-30 19:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
postgis-build.log (postgis-build.log,88.26 KB, text/plain)
2017-09-29 11:53 UTC, Michael Orlitzky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Orlitzky gentoo-dev 2017-09-29 11:53:55 UTC
Created attachment 496998 [details]
postgis-build.log

It looks like Postgis can't be linked with the Gold linker. I ran into the following build failure while testing Github PR #5722.

  $ sudo binutils-config --linker ld.gold
  $ sudo USE="-gtk" emerge -pv1 postgis
  These are the packages that would be merged, in order:

  Calculating dependencies... done!
  [ebuild   R    ] dev-db/postgis-2.1.8-r1::gentoo  USE="-doc -gtk -static-libs 
  {-test}" 0 KiB

Eventually the build fails with,

  libtool: link: x86_64-pc-linux-gnu-gcc -I ../liblwgeom -march=native -O2
  -pipe -fPIC -DPIC -Wall -Wmissing-prototypes shpopen.o dbfopen.o getopt.o
  shpcommon.o safileio.o shp2pgsql-core.o shp2pgsql-cli.o -o .libs/shp2pgsql 
  -Wl,-O1 -Wl,-rpath -Wl,/usr/lib64/postgresql-9.4/lib64 -Wl,--enable-new-dtags  
  ../liblwgeom/.libs/liblwgeom.so -L/usr/lib64 -lgeos_c -lproj -ljson-c
  -L/usr/lib64/postgresql-9.4/lib64 -Wl,--as-needed -lc
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'sqrt'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'atan'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'floor'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'atan2'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'sincos'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'remainder'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'acos'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'asin'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'sin'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'cos'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'log10'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'log'
  ../liblwgeom/.libs/liblwgeom.so: error: undefined reference to 'tan'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:103: shp2pgsql] Error 1
  make[1]: Leaving directory '/var/tmp/portage/dev-db/postgis-2.1.8-r1/work
  /postgis-2.1.8/loader'

Switching back to the BFD linker,

  $ sudo binutils-config --linker ld.bfd

works around the issue.

The problem is that one or more pieces of Postgis are underlinked: they make use of functions in a library that isn't explicitly mentioned in the linker command. For example, adding "-lm" to the linker command above (to link against the math library) makes it succeed.
Comment 1 Michael Orlitzky gentoo-dev 2017-09-30 19:41:31 UTC
This was fixed upstream in their VCS and will trickle down into the releases eventually.