[postgis-devel] liblwgeom symbols exported by postgis module

a.furieri at lqt.it a.furieri at lqt.it
Thu Oct 1 05:34:52 PDT 2015


Hi all,

hoping that the following considerations could someway help you.

in the past SpatiaLite experienced lots of "crazy" and extravagant
troubles very difficult to be identified and fixed.
after the initial confusion it finally emerged crystal clear that
the cause was just one, i.e. badly mixing static and dynamic linkage.

as we discovered after performing a rather thorough final analysis some
very complex package such as QGIS ended up by directly or indirectly
linking *three* different versions of libsqlite and libspatialite:
#1. a first private copy statically linked by the core C++ app
#2. a different second private copy statically linked by the
     Python connector.
#3. the standard system dynamic libraries linked by GDAL/OGR

not at all surprisingly, mixing more or less at random three
different (and may well be conflicting) versions of the some
libraries within a single process address space is not the
safest way to promote robustness and stability.

the lesson we learned from this sad mishap:
- on any Unix-like system (Linux, MacOsX, BSD and so on)
   using the static linkage should always be strongly
   discouraged.
   I fully agree with Bas; on these platforms correctly using
   dynamic libraries clearly identified by their SONAME works
   really nicely and should always be the preferred solution.
- things are really different on Windows platforms: here using
   a full static linkage could sometimes be a very reasonable
   approach for deploying simple self contained applications
   as monolithic *.EXE modules without any external dependency.
   but if your intention is deploying a rather complex framework
   using an approach fully based on many DLLs is the unique
   viable choice even on Windows, as e.g. supported by OSGeo4Win.
- any other "creative" solution based on mixing static and dynamic
   linkage will almost certainly introduce some unwanted vulnerability
   and will cause some unexpected damage before or after.

the specific case of PostgreSQL/PostGIS is obviously different
from the SpatiaLite's own scenario because PostgreSQL is
client/server whilst SQLite isn't.
the net separation between server and client processes will
surely help to actively prevent many possible troubles.
anyway I still continue to believe that using the static linkage
on Linux simply as a way to circumvent and possibly simplify the
correct approach based on SONAME is a potentially dangerous
approach.

OTH Sandro



More information about the postgis-devel mailing list