Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Feb 1996 09:07:01 -0800
From:      John Polstra <jdp@polstra.com>
To:        jb@cimlogic.com.au
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: rtld LD_NO_INTERN_SEARCH and LD_LIBRARY_PATH
Message-ID:  <199602151707.JAA28743@austin.polstra.com>

next in thread | raw e-mail | index | archive | help
> The man file for rtld describes an environment variable called
> LD_NO_INTERN_SEARCH. This does not appear to be implemented.

That's correct.

> The man file says that LD_LIBRARY_PATH is "A colon separated list
> of directories, overriding the default search path for shared
> libraries."

Actually, it _augments_ the default search path.  First, directories in
LD_LIBRARY_PATH are searched, then directories in the default search
path.  (The default search path is just "/usr/lib", plus whatever has
been put into the hints file via ldconfig.)

> We *always* use -nostdlib and *never* -l to specify libraries. Our
> build process gives an explicit path to the shared library that we
> want it to link against. This path is written by ld into the
> executable file. When we release the programs and libraries, we
> expect to be able to set LD_LIBRARY_PATH to the place where the
> libraries are installed, not where they were when the program was
> linked. This does not work because rtld is always taking the path
> in the executable.

Yes, if you specify an explicit path on the "ld" command line, then that
path goes into the executable file, verbatim.  In that case, rtld will
use the path directly -- no searching will be done.

If you want rtld to search for a shared library, you must specify it
on the "ld" command line using the "-l" option.

> After running automatic tests on programs like this, we release to
> a /u/rel tree. We don't want to have released programs using shared
> libraries out of the /u/dev tree.
> 
> Any hints as to how we can do this?

Don't specify explicit library pathnames on the "ld" command line.
Instead, use "-L" and "-l".  For example, instead of specifying
"/u/dev/cim/lib/dhu.so.1.1", use "-L/u/dev/cim/lib -ldhu".

Then, at runtime, make sure you have "/u/rel" in your LD_LIBRARY_PATH
environment variable.
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



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