From owner-freebsd-questions@FreeBSD.ORG Mon Nov 29 15:01:34 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 4A6CC1065675 for ; Mon, 29 Nov 2010 15:01:34 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from dirj.bris.ac.uk (dirj.bris.ac.uk [137.222.10.78]) by mx1.freebsd.org (Postfix) with ESMTP id 044B38FC26 for ; Mon, 29 Nov 2010 15:01:33 +0000 (UTC) Received: from ncsc.bris.ac.uk ([137.222.10.41]) by dirj.bris.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1PN5ES-0006UH-Ne; Mon, 29 Nov 2010 15:01:32 +0000 Received: from mech-cluster241.men.bris.ac.uk ([137.222.187.241]) by ncsc.bris.ac.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1PN5ES-0004PR-CV; Mon, 29 Nov 2010 15:01:32 +0000 Received: from mech-cluster241.men.bris.ac.uk (localhost [127.0.0.1]) by mech-cluster241.men.bris.ac.uk (8.14.4/8.14.4) with ESMTP id oATF1WN2059290; Mon, 29 Nov 2010 15:01:32 GMT (envelope-from mexas@bristol.ac.uk) Received: (from mexas@localhost) by mech-cluster241.men.bris.ac.uk (8.14.4/8.14.4/Submit) id oATF1V3x059264; Mon, 29 Nov 2010 15:01:31 GMT (envelope-from mexas@bristol.ac.uk) X-Authentication-Warning: mech-cluster241.men.bris.ac.uk: mexas set sender to mexas@bristol.ac.uk using -f Date: Mon, 29 Nov 2010 15:01:31 +0000 From: Anton Shterenlikht To: Tijl Coosemans Message-ID: <20101129150131.GA45297@mech-cluster241.men.bris.ac.uk> Mail-Followup-To: Tijl Coosemans , freebsd-questions@freebsd.org, Anton Shterenlikht References: <20101129135058.GA6756@mech-cluster241.men.bris.ac.uk> <201011291500.52940.tijl@coosemans.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201011291500.52940.tijl@coosemans.org> User-Agent: Mutt/1.4.2.3i Cc: Anton Shterenlikht , freebsd-questions@freebsd.org 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 15:01:34 -0000 On Mon, Nov 29, 2010 at 03:00:45PM +0100, Tijl Coosemans wrote: > 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 -lslatec Tijl, thank you. Both options work for me on amd64 and ia64. thanks anton -- Anton Shterenlikht Room 2.6, Queen's Building Mech Eng Dept Bristol University University Walk, Bristol BS8 1TR, UK Tel: +44 (0)117 331 5944 Fax: +44 (0)117 929 4423