Subject: Re: Question about ld.so.conf
To: T@W <lsp93@xs4all.nl>
From: None <collver@linuxfreemail.com>
List: port-i386
Date: 02/10/2001 06:36:07
On Sat, Feb 10, 2001 at 07:15:59AM +0100, T@W wrote:
> Reading the following :
> 
> >Some OS's (e.g. Linux) have a configurable loader. You can configure what
> >run-time paths to look in by modifying /etc/ld.so.conf. This is almost as
> >bad a LD_LIBRARY_PATH! Install scripts should never modify this file! This
> >file should contain only the standard library locations as shipped with
> >the OS.
> 
> So what is the right thing to do?

The "right" thing to do is to build any non-system library search path into
the binary when linking.  For instance, if your application uses GNU readline:
gcc -o goober goober.c -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lreadline -lcurses

The -Wl,-R/usr/pkg/lib makes gcc invoke ld with the additional argument
-R/usr/pkg/lib, which tells the linker to add /usr/pkg/lib to the runtime
library search path.

Ben
-- 
"I will protect you from your visions to save you from delusions.
 I will protect you from ideals to save you from defeat." -Covenant