linking against shared libraries not in default path

Tijl Coosemans tijl at coosemans.org
Mon Nov 29 14:30:16 UTC 2010


On Monday 29 November 2010 14:50:59 Anton Shterenlikht wrote:
> I compiled some numerical libraries under my home
> directory, including static and shared libs. The
> shared lib is
> 
> % ls ./src/libslatec.so.1
> ./src/libslatec.so.1
> %
> 
> Now I'd like to test shared libraries, so I do 
> 
> % gfortran45 -o test01.x test01.o qc6a.o -L./src/ -lslatec
> % ./test01.x 
> /libexec/ld-elf.so.1: Shared object "libslatec.so.1" not found, required by "test01.x"
> %
> 
> How can I tell the executable to look for a shared library
> in a specific directory? I tried setting LIBRARY_PATH, but
> it didn't help.

The name of the variable is LD_LIBRARY_PATH. It is described in the
rtld(1) manpage. You can also add it to the executable using -R as in:

% gfortran45 -o test01.x test01.o qc6a.o -L./src/ -R<full path> -lslatec
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20101129/a2e0bd3f/attachment.pgp


More information about the freebsd-questions mailing list