Subject: Re: upgrading openssl - LD_LIBRARY_PATH / LIBPATH
To: None <netbsd-help@NetBSD.org>
From: James K. Lowden <jklowden@schemamania.org>
List: netbsd-help
Date: 07/10/2005 12:48:30
Robert Cates wrote:
> I'm still not sure why that worked, as
> opposed to the message(s) about using libtool and setting
> LD_LIBRARY_PATH / LIBPATH though. Is there any documentation on this
> sort of thing when building/installing pkgsrc software?
LD_LIBRARY_PATH does not affect the build. It's a runtime variable: it's
read by the runtime linker to affect where it looks for things.
ISTM that linker paths are in general poorly understood by most mortals.
Most NetBSD architectures' executables are in ELF format, and ELF has a
section for the RPATH, the runtime linker path. It's similar to the PATH
your shell uses to find executables. LD_LIBRARY_PATH extends it. The
security guys will tell you not to use LD_LIBRARY_PATH, but rather to link
your executables with the right RPATH, which is what you did (indirectly)
when you used PREFER.openssl=pkgsrc.
For more information, probably more than you want to know:
http://www.netbsd.org/Documentation/elf.html
man ld.elf_so
man readelf # good starting point
ftp://tsx.mit.edu/pub/linux/packages/GCC/ELF.doc.tar.gz
Some of the other GNU binutils docs may also be helpful.
And just to give you a head start:
$ readelf -d $(command -v bash) |sed -ne'1,/rpath/p'
Dynamic segment at offset 0x8577c contains 20 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libtermcap.so.0]
0x00000001 (NEEDED) Shared library: [libintl.so.0]
0x00000001 (NEEDED) Shared library: [libc.so.12]
0x0000000f (RPATH) Library rpath: [/usr/pkg/lib]
HTH.
--jkl