[gdal-dev] Linking proj statically/dynamically

Even Rouault even.rouault at spatialys.com
Fri Nov 2 13:45:54 PDT 2018


On vendredi 2 novembre 2018 16:32:29 CET Andrew Bell wrote:
> Hi,
> 
> I'm trying to figure out what might be going on with setting things up for
> proj with GDAL.  If I set
> --with-proj=/directory/to/where/proj/is/installed, I end up with
> PROJ_STATIC set to true, even though I have no static proj library built (I
> only have libproj.so, no libproj.a in the install directory).  Looking at
> configure.ac, I'm not seeing anything that would explicitly check for a
> static library at all, just a bunch of checks for a proj library of various
> incarnations in various directories relative to the one I set in
> --with-proj.
> 

The 'static' here is not to be understood as linking against a static library, 
but linking at build time against a .a or .so. To be opposed to the default 
mode which uses dlopen()

> At the conclusion of configuration, GDALmake.opt sets LIBS includes the
> proper information to link:
> 
> LIBS = ... -L/directory/to/where/proj/is/installed/lib -lproj ...
> 
> But no rpath is entered to support locating the proj library when linking
> another project with GDAL, which means that I get errors at link time
> asking for me to add --rpath-link to my link line.

AFAIK GDAL never sets rpath

> 
> What, exactly, is --with-proj supposed to do and how does it interact with
> static linking of proj, assuming I have libproj.a somewhere?

--with-proj should behave similarly to linking against other libraries if 
you've only .so, only .a or both (in later case, not sure which one will be 
choosen, but that will be whatever the linker does in those cases)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list