From owner-freebsd-questions@FreeBSD.ORG Mon Nov 29 14:30:16 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91DDF1065673 for ; Mon, 29 Nov 2010 14:30:16 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay004.isp.belgacom.be (mailrelay004.isp.belgacom.be [195.238.6.170]) by mx1.freebsd.org (Postfix) with ESMTP id 26B818FC15 for ; Mon, 29 Nov 2010 14:30:15 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am0GADZA80xbsZH3/2dsb2JhbACUe44BcsIvhUcE Received: from 247.145-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.145.247]) by relay.skynet.be with ESMTP; 29 Nov 2010 15:00:57 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.4/8.14.4) with ESMTP id oATE0sHs003426; Mon, 29 Nov 2010 15:00:55 +0100 (CET) (envelope-from tijl@coosemans.org) From: Tijl Coosemans To: freebsd-questions@freebsd.org Date: Mon, 29 Nov 2010 15:00:45 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.5.2; i386; ; ) References: <20101129135058.GA6756@mech-cluster241.men.bris.ac.uk> In-Reply-To: <20101129135058.GA6756@mech-cluster241.men.bris.ac.uk> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1332642.6ZWloR6saY"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201011291500.52940.tijl@coosemans.org> Cc: Anton Shterenlikht Subject: Re: linking against shared libraries not in default path X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2010 14:30:16 -0000 --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 -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--