Opened 13 years ago

Closed 13 years ago

#1685 closed defect (wontfix)

[raster] Regress build failure with two versions of GEOS

Reported by: mwtoews Owned by: strk
Priority: medium Milestone: PostGIS 2.0.0
Component: build Version: 2.0.x
Keywords: Cc:

Description

I'm writing simple install instructions for PostGIS 2.0 at UsersWikiInstall. They all appear to install properly, although I'm in the middle of testing.

However, make check has a reproducible error (on all Ubuntu and Debian systems, using instructions from UsersWikiInstall) with postgis-2.0.0beta2SVN:

$ make check
...
---- Making check in raster
make[1]: Entering directory `/home/mwtoews/postgis-2.0.0beta2SVN/raster'
make -C test check
make[2]: Entering directory `/home/mwtoews/postgis-2.0.0beta2SVN/raster/test'
make -C core check
make[3]: Entering directory `/home/mwtoews/postgis-2.0.0beta2SVN/raster/test/core'
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes -I../../rt_core -I/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom  -I/usr/include/gdal -I/usr/local/include -o testapi testapi.c ../../rt_core/librtcore.a /home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a -L/usr/lib -lgdal1.7.0 -L/usr/local/lib -lgeos_c -lm
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a(lwgeom_geos.o): In function `LWGEOM2GEOS':
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos.c:326: undefined reference to `GEOSGeom_createEmptyPolygon'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a(lwgeom_geos.o): In function `lwgeom_snap':
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos.c:967: undefined reference to `GEOSSnap'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a(lwgeom_geos.o): In function `lwgeom_sharedpaths':
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos.c:1030: undefined reference to `GEOSSharedPaths'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a(lwgeom_geos.o): In function `lwgeom_offsetcurve':
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos.c:1080: undefined reference to `GEOSOffsetCurve'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a(lwgeom_geos_clean.o): In function `LWGEOM_GEOS_makeValidPolygon':
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos_clean.c:427: undefined reference to `GEOSGeom_extractUniquePoints'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos_clean.c:440: undefined reference to `GEOSGeom_extractUniquePoints'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos_clean.c:478: undefined reference to `GEOSGeom_createEmptyPolygon'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a(lwgeom_geos_clean.o): In function `LWGEOM_GEOS_makeValid':
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos_clean.c:863: undefined reference to `GEOSGeom_extractUniquePoints'
/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/lwgeom_geos_clean.c:864: undefined reference to `GEOSGeom_extractUniquePoints'
collect2: ld returned 1 exit status
make[3]: *** [testapi] Error 1
make[3]: Leaving directory `/home/mwtoews/postgis-2.0.0beta2SVN/raster/test/core'
make[2]: *** [core-check] Error 2
make[2]: Leaving directory `/home/mwtoews/postgis-2.0.0beta2SVN/raster/test'
make[1]: *** [check] Error 2
make[1]: Leaving directory `/home/mwtoews/postgis-2.0.0beta2SVN/raster'
make: *** [check] Error 1

In the instructions (e.g., UsersWikiPostGIS20Ubuntu1004src), I'm suggesting to apt-get install gdal-dev, which installs a second version of GEOS as a dependency. Clearly the errors above reflect this, but I don't see the same errors when building/installing raster. I.e.,

$ cd raster/loader
$ make clean
rm -rf .libs
rm -f *.o raster2pgsql
$ make
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes -I../rt_core -I/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom  -I/usr/include/gdal -I/usr/local/include -c raster2pgsql.c
/bin/bash ../..//libtool --mode=link gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes -I../rt_core -I/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom  -I/usr/include/gdal -I/usr/local/include raster2pgsql.o ../rt_core/librtcore.a ../rt_core/librtcore.a ../../liblwgeom/liblwgeom.la -L/usr/lib -lgdal1.6.0 -L/usr/local/lib -lgeos_c -lm -o raster2pgsql
mkdir .libs
gcc -g -O2 -fPIC -DPIC -Wall -Wmissing-prototypes -I../rt_core -I/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom -I/usr/include/gdal -I/usr/local/include raster2pgsql.o -o .libs/raster2pgsql  ../rt_core/librtcore.a ../../liblwgeom/.libs/liblwgeom.so -L/usr/local/lib /usr/local/lib/libgeos_c.so /usr/local/lib/libgeos.so /usr/lib/libproj.so -L/usr/lib -lgdal1.6.0 /usr/lib/libgeos_c.so /usr/lib/libgeos.so -lm
creating raster2pgsql

Here is some info that may (or may not) be useful from one of the systems (using UsersWikiPostGIS20Ubuntu1004src instructions):

$ locate libgeos.so
/usr/lib/libgeos.so
/usr/local/lib/libgeos.so
$ /usr/bin/geos-config --version
3.1.0
$ /usr/local/bin/geos-config --version
3.3.2
$ which geos-config
/usr/local/bin/geos-config
$ which gdal-config
/usr/bin/gdal-config
$ gdal-config --dep-libs
-L/usr/lib -lgeos_c -I/usr/include -lsqlite3 -lodbc -lodbcinst -L/usr/lib -lexpat -L/usr/lib -lxerces-c -lpthread -ljasper -lhdf5 -lmfhdfalt -ldfalt -logdi -lgif -ljpeg -lpng -lnetcdf -lpq -L/usr/lib -lpq -lz -lpthread -lm -lrt -ldl -lcurl -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient

Change History (2)

comment:1 by strk, 13 years ago

The problem is your linker trying to use the geos lib in /usr/lib rather than the one in /usr/local/lib. Maybe try swapping -L lines in this call:

gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes -I../../rt_core -I/home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom  -I/usr/include/gdal -I/usr/local/include -o testapi testapi.c ../../rt_core/librtcore.a /home/mwtoews/postgis-2.0.0beta2SVN/liblwgeom/.libs/liblwgeom.a -L/usr/lib -lgdal1.7.0 -L/usr/local/lib -lgeos_c -lm

That is, move the "-L/usr/lib -lgdal1.7.0" after "-L/usr/local/lib -lgeos_c"

Also consider dropping the old geos in /usr/lib or at least the libgeos_c.so from /usr/lib (the new libgeos_c.so in /usr/local/lib would work just fine with _any_ client code)

comment:2 by strk, 13 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.