[gdal-dev] Linking proj statically/dynamically

Andrew Bell andrew.bell.ia at gmail.com
Fri Nov 2 15:49:27 PDT 2018


On Fri, Nov 2, 2018 at 4:45 PM Even Rouault <even.rouault at spatialys.com>
wrote:

> 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().
>

This is confuing.  Perhaps changing the name of the macro would be
helpful.  I could do this if nobody minds.


> > 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
>

In this case, since you're providing a SPECIFIC library path at
configuration, it would seem reasonable to store that information in the
created GDAL library.  Otherwise, I'm not sure what the point is, since you
can provide a library search path at link time through the environment.

> 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)
>

Why is proj special?  Why is it not always linked to the GDAL library like
so many other things?  Why would one want to dlopen() proj instead of
having it located as other libraries are located at link/runtime?  I'm sure
there's a reason ;)

Thanks,

-- 
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181102/17f727ae/attachment.html>


More information about the gdal-dev mailing list