[postgis-devel] liblwgeom symbols exported by postgis module

Sandro Santilli strk at keybit.net
Mon Sep 21 07:49:00 PDT 2015


I'm writing a PostgreSQL extension that's meant to cohexist with
PostGIS and was willing to dynamically link it to a system installed
liblwgeom (mostly to avoid having to deal with resolving all symbols
needed by liblwgeom: geos, proj, sfcgal, whatnot).

Doing this I've discovered that the linux runtime environment can get
confused about where to find a given symbol, so that _some_ functions
are really served by the liblwgeom library that was found at build
time and some others are served by the liblwgeom library embedded
in the PostGIS module (loaded by the same PostgreSQL backend process).

One way to fix this "clash" would be to build the PostGIS module so
to _not_ re-export symbols imported from the libraries it depends to.
I think this is a good thing to do, to reduce noise/confusion/size;
when using the GNU linker, "--exclude-libs ALL" switch can be used
for that, and a patch to that extent can be found starting from here:
https://trac.osgeo.org/postgis/ticket/3281

Another way might be to build the new (first versioned) liblwgeom
with symbol level versioning, but I hadn't tried that.

Finally, last possibility is to just give up on dynamically linking
the PostgreSQL module to liblwgeom and follow the static-link route
also taken by PostGIS, which means, if I'm not mistaken, also having
to deal with linking all of the liblwgeom dependencies
(GEOS, PROJ, SFCGAL).

While I know Paul and Regina will be laughing on me on this,
is there anyone with ideas on what the best way to deal with
these static-linking pollution matters ?

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-devel mailing list