Subject: Re: Trouble intalling teTeX
To: john heasley <heas@shrubbery.net>
From: Dave Uhring <duhring@charter.net>
List: port-i386
Date: 05/16/2003 21:20:23
On Friday 16 May 2003 06:55 pm, john heasley wrote:
> Fri, May 16, 2003 at 06:22:44PM -0500, Dave Uhring:
> > On Friday 16 May 2003 06:08 pm, john heasley wrote:
> > > Sat, May 17, 2003 at 12:07:39AM +0200, Manuel Bouyer:
> > > > On Fri, May 16, 2003 at 11:57:17AM -0400, Yasir Malik wrote:
> > > > > Thank you very much!  I put LD_LIBRARY_PATH=/usr/X11R6/lib in
> > > > > .profile.
> > > >
> > > > But this isn't a good solution. It means your programs were
> > > > compiled with innapropriate flags.
> > > > Try adding
> > > > -Wl,-R/usr/X11R6/lib to the linker flags (adding it near
> > > > -L/usr/X11R6/lib should be enouth).
> > >
> > > -Wl,-rpath=/usr/X11R6/lib ?
> > >
> > > out of curiosity, why isnt the rpath (LD_RUN_PATH) automatically
> > > updated by the linker?  every dynamic-linked binary will need to
> > > find it's libs. iirc, sunos did/does this.
> >
> > SunOS (Solaris) requires that the libraries be linked with the
> > -R/usr/whatever/lib LDFLAG at compile time.  There is no automatic
> > LD_RUN_PATH installed in any user's environment, nor should there
> > be; same as NetBSD.
>
> i thought (may have bit rot) the sunos (ie: 4.1.2) linker added the
> the -L paths to the ELF headers.
>
> anyway, "nor should there be"...i agree it should not alter one's
> environment, but why not executable's headers?  according to
> ld.elf_so(1)

Compile time linking with the -R/usr/whatever/lib flag does indeed place 
the library path in the executable binary's headers in Solaris and 
NetBSD too, although most people use -Wl,-R/usr/whatever/lib with 
NetBSD.  The -L paths are used at compile/link time not run time.

>      The linker will search for libraries in three lists of paths:
>
>      1.   A user defined list of paths as specified in
> LD_LIBRARY_PATH and ld.so.conf(5).

LD_LIBRARY_PATH is evil and should never be considered for use.  Google 
for that expression and you will see what I mean.

>           The use of ld.so.conf should be avoided as the setting of a
> global search path can present a security risk.

Just one of the problems with Linux.

>      2.   A list of paths specified within a shared object using a
> DT_RPATH entry in the dynamic section.  This is defined at shared
> object link time.
>
>      3.   The list of default paths which is set to /usr/lib.
>
> so, even if DT_RPATH is populated by the linker, it can be
> over-ridden by the user.

Use the correct flags at compile and link time and no overrides are 
required although such things as LD_PRELOAD can be used for that 
purpose.