Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 2010 15:00:45 +0100
From:      Tijl Coosemans <tijl@coosemans.org>
To:        freebsd-questions@freebsd.org
Cc:        Anton Shterenlikht <mexas@bristol.ac.uk>
Subject:   Re: linking against shared libraries not in default path
Message-ID:  <201011291500.52940.tijl@coosemans.org>
In-Reply-To: <20101129135058.GA6756@mech-cluster241.men.bris.ac.uk>
References:  <20101129135058.GA6756@mech-cluster241.men.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart1332642.6ZWloR6saY
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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
>=20
> % ls ./src/libslatec.so.1
> ./src/libslatec.so.1
> %
>=20
> Now I'd like to test shared libraries, so I do=20
>=20
> % gfortran45 -o test01.x test01.o qc6a.o -L./src/ -lslatec
> % ./test01.x=20
> /libexec/ld-elf.so.1: Shared object "libslatec.so.1" not found, required =
by "test01.x"
> %
>=20
> 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

--nextPart1332642.6ZWloR6saY
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iF4EABEIAAYFAkzzshQACgkQfoCS2CCgtistpwD/QWYw6j7SrT12UdvGiTd6nOfp
ppTZRawLXK0z47kGL2oA/2EyEtTs59c3m6IJK0mi+11mJUxcs9wAgK79/ZsVEj54
=LNww
-----END PGP SIGNATURE-----

--nextPart1332642.6ZWloR6saY--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011291500.52940.tijl>