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

next in thread | previous in thread | raw e-mail | index | archive | help
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<full path> -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



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