Subject: Re: dynamic linking
To: Quentin Garnier <netbsd@quatriemek.com>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-userlevel
Date: 03/19/2003 09:22:01
On Wed, 19 Mar 2003, Quentin Garnier wrote:

> Le Wed, 19 Mar 2003 10:31:58 +0200
> Lucio De Re a ecrit :
> [...]
> > 	Shared object "libX11.so.6" not found
> [...]
> > 	export
> > 	LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib:/usr/pkg/lib:/usr/local/l
> > 	ib
> >
> > solves the problem perfectly adequately, but I'm lost as to why this
> > is required.  I thought I knew how ".so"s worked, but evidently I'm
> > missing something.
>
> ld.elf_so needs a hint on where to find libraries. You can add hints in
> /etc/ld.so.conf (adding /usr/X11R6/lib here is fine),

That's not supposed to work on NetBSD. The file installed with the
system by default has a different format (and a different purpose).

> or add it in the
> linked file it's self, it's called a RPATH entry.
>
> -Wl,-R ld/gcc option adds the convenient hint entry into the resulting
> binary. Usually you will prefer the later solution, but then you have to
> modify the clinking options to add the correct one.

A simpler way is to set LD_RUN_PATH in the build environment. That
only works, however, if there are no "Wl,-R" or "-Wl,-rpath" options
at all.

Frederick