DUB linking to local library

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 3 21:21:25 PDT 2015


On Tuesday, 4 August 2015 at 03:20:38 UTC, Craig Dillabaugh wrote:
> ldd gdaltest
>         linux-vdso.so.1 (0x00007ffe63381000)
>         libgdal.so.20 => not found
>
> I can now run it with:
>
> LD_LIBRARY_PATH=/home/craig2/code/gdal-2.0.0/lib64 ./gdaltest
>
> But it appears the LD_LIBRARY_PATH hack is causing havoc with 
> other libraries, as I get errors loading other shared libraries 
> when I do that.

Linkers, so fun they are...
https://wiki.debian.org/RpathIssue

As you can see in the search order RPATH takes precedence over 
LD_LIBRARY_PATH.
If we assume that you want LD_LIBRARY_PATH to be able to override 
the lib you could use the following flags.

"lflags" : [ "--enable-new-dtags", 
-"rpath=/home/craig2/code/gdal-2.0.0/lib64/", 
"-L/home/craig2/code/gdal-2.0.0/lib64/" ]

you can see what it is in the binary with: readelf --dynamic 
gdaltest|grep PATH

This should make LD_LIBRARY_PATH redundant.

//Joakim


More information about the Digitalmars-d-learn mailing list