Re: -rpath with libtool and Debian Linux
Date: Sat, 30 Jan 1999 23:42:32 +0100
From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
> In general, it's convenient to store the path in the executable any
> time a shared library is installed in a directory which the dynamic
> linker does not search by default.
Yes, I should have narrowed my question to system libraries. Unfortunately,
system libraries are most likely to cause the problems, for example if
people hard code /usr/X11R6/lib/ for xaw library and you want to use
It's hard to distinguish system libraries from non-system libraries,
except by the distinction quoted above: a non-system library is a
library installed in a directory which the dynamic linker does not
search by default.
Unfortunately, the GNU/Linux dynamic linker reportedly uses a rather
complex algorithm, in which it makes decisions based on the libc
version number which libraries are linked against, which would seem to
make it hard to determine just which directories the dynamic linker
searches by default.
In the normal case I think one can assume that the dynamic linker will
search any directory listed in /etc/ld.so.conf, and it would be OK to
omit a -rpath argument for any shared library installed in one of the
directories listed in that file.
Note that although you can set up a case in which the xaw library is
found in /usr/X11R6/lib, it's not normal. Normally the program will
be linked against libxaw.so.N, and will have a specified search path,
the rpath, to find that file.
> Incidentally, I don't know what you mean by saying both soname and
> library name. There is only one name recorded for a shared library:
> the soname.
Ignorance I think. I thought soname is only the number, and a lib is stored
in libfoo.x.y.z, where foo is the library name and x.y.z the soname. If I
got it wrong, I apologize.
When I, and I think most others, use the word soname, I refer to the
DT_SONAME tag in a shared library which appears in a DT_NEEDED tag in
the executable. The soname is set in a shared library using the
-h/--soname option, and is copied into the executable by the program
linker. In this case the soname is the full name of the file: