[postgis-devel] theory of how proj is linked in?

Greg Troxel gdt at lexort.com
Sun Jun 21 16:47:16 PDT 2020


I am, belatedly for no good reason, trying to update pkgsrc to 3.0.1
from 2.5.3.   Dependencies found during configure look good:

 -------------- Dependencies --------------
  GEOS config:          /usr/pkg/bin/geos-config
  GEOS version:         3.8.1
  GDAL config:          /usr/pkg/bin/gdal-config
  GDAL version:         3.0.4
  PostgreSQL config:    /tmp/work/databases/postgresql-postgis2/work/.buildlink/bin/pg_config
  PostgreSQL version:   PostgreSQL 10.13
  PROJ4 version:        63
  Libxml2 config:       /tmp/work/databases/postgresql-postgis2/work/.buildlink/bin/xml2-config
  Libxml2 version:      2.9.10
  JSON-C support:       no
  protobuf support:     no
  PCRE support:         no
  Perl:                 /usr/pkg/bin/perl
  Wagyu:                no

Then, in linking shp2pgsql, I get undefined symbols.  These are declared
in geodesic.h from proj, and in libproj.so.  But there is no -lproj on
the link line.

With raster2pgsql, it links, and I see -lproj, but can't find in
Makefile where it comes from.

it seems to me that if liblwgeom.a uses proj, then things that add that
library have to add -lproj as well.

However, in config.status I see
  S["PROJ_LIBS"]=""                                                                                                                                                            

which doesn't make sense and isn't consistent with 1) raster2pgsql
linking or 2) the output above.

Can someone explain to me the theory of how liblwgeom.a uses proj and
how it gets linked?



libtool: link: gcc -I../liblwgeom -Wall -Wmissing-prototypes -std=gnu99 -O2 -D_FORTIFY_SOURCE=2 -I/tmp/work/databases/postgresql-postgis2/work/.buildlink/include -I/tmp/wor\
k/databases/postgresql-postgis2/work/.buildlink/include/glib-2.0 -I/tmp/work/databases/postgresql-postgis2/work/.buildlink/include/gio-unix-2.0 -I/tmp/work/databases/postgr\
esql-postgis2/work/.buildlink/lib/glib-2.0/include -I/tmp/work/databases/postgresql-postgis2/work/.x11-buildlink/include -I/tmp/work/databases/postgresql-postgis2/work/.bui\
ldlink/include/freetype2 -I/tmp/work/databases/postgresql-postgis2/work/.buildlink/include/krb5 -fno-math-errno -fno-signed-zeros -fPIC -DPIC shpopen.o dbfopen.o getopt.o s\
hpcommon.o safileio.o shp2pgsql-core.o shp2pgsql-cli.o -o shp2pgsql -Wl,-rpath -Wl,/usr/pkg/lib -Wl,--as-needed -Wl,-rpath -Wl,/usr/pkg/lib  -L/tmp/work/databases/postgresq\
l-postgis2/work/.buildlink/lib -L/tmp/work/databases/postgresql-postgis2/work/.x11-buildlink/lib ../liblwgeom/.libs/liblwgeom.a -lgeos_c -lgeos -lm -lintl -lc -Wl,-rpath,/t\
mp/work/databases/postgresql-postgis2/work/.buildlink/lib -Wl,-rpath,/tmp/work/databases/postgresql-postgis2/work/.buildlink/lib
../liblwgeom/.libs/liblwgeom.a(lwspheroid.o): In function `ptarray_area_spheroid.isra.7.part.8':
lwspheroid.c:(.text+0x3e): undefined reference to `geod_init'
lwspheroid.c:(.text+0x4d): undefined reference to `geod_polygon_init'
lwspheroid.c:(.text+0x96): undefined reference to `geod_polygon_addpoint'
lwspheroid.c:(.text+0xbd): undefined reference to `geod_polygon_compute'
../liblwgeom/.libs/liblwgeom.a(lwspheroid.o): In function `spheroid_distance':
lwspheroid.c:(.text+0x4d3): undefined reference to `geod_init'
lwspheroid.c:(.text+0x5bd): undefined reference to `geod_inverse'
../liblwgeom/.libs/liblwgeom.a(lwspheroid.o): In function `spheroid_direction':
lwspheroid.c:(.text+0x61c): undefined reference to `geod_init'
lwspheroid.c:(.text+0x715): undefined reference to `geod_inverse'
../liblwgeom/.libs/liblwgeom.a(lwspheroid.o): In function `spheroid_project':
lwspheroid.c:(.text+0x7ba): undefined reference to `geod_init'
lwspheroid.c:(.text+0x87a): undefined reference to `geod_direct'
gmake[2]: *** [Makefile:104: shp2pgsql] Error 1



More information about the postgis-devel mailing list