Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 632354

Summary: dev-db/postgis: link failures with ld.gold
Product: Gentoo Linux Reporter: Michael Orlitzky <mjo>
Component: Current packagesAssignee: PgSQL Bugs <pgsql-bugs>
Status: RESOLVED UPSTREAM    
Severity: normal CC: sci-geosciences
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://trac.osgeo.org/postgis/ticket/3869
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: postgis-build.log

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.