From owner-freebsd-hackers Thu Feb 15 09:07:45 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA09224 for hackers-outgoing; Thu, 15 Feb 1996 09:07:45 -0800 (PST) Received: from austin.polstra.com (austin.polstra.com [206.213.73.10]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA09219 for ; Thu, 15 Feb 1996 09:07:43 -0800 (PST) Received: from austin.polstra.com (jdp@localhost) by austin.polstra.com (8.6.12/8.6.12) with ESMTP id JAA28743; Thu, 15 Feb 1996 09:07:01 -0800 Message-Id: <199602151707.JAA28743@austin.polstra.com> To: jb@cimlogic.com.au Cc: freebsd-hackers@freebsd.org Subject: Re: rtld LD_NO_INTERN_SEARCH and LD_LIBRARY_PATH Date: Thu, 15 Feb 1996 09:07:01 -0800 From: John Polstra Sender: owner-hackers@freebsd.org Precedence: bulk > 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