Re: -rpath with libtool and Debian Linux
Alexandre Oliva wrote:
> More than that (and it was my fault to have failed to mention that
> before): libtool will hard-code the installation directory of the
> library into the `libdir' variable of the .la script it installs.
> Therefore, if one moves the library then tries to link with the .la
> file, he loses. There's also the dlopening issue: libltdl (to be
> released with libtool 1.3) will dlopen a library in the directory
> pointed to by `libdir' too.
Well, that's actually not true. libltdl will try to dlopen the library
in the directory where the .la file was found, too.
> In general, I feel that moving libraries around is a very bad idea,
> because it will lead to failure most of the times, and that's why I
> don't feel libtool should help people doing that.
Moving libraries should be avoided, but libtool shouldn't
make it impossible.
> Actually, not issuing -rpath or equivalent is quite easy to do, but
> choosing *when* not to do it is the part that is hard to port. Thomas
> Tanner has suggested that we could omit the -rpath switch for
> libraries that are supposed to be installed in directories listed in
> the default search path. However, the default search PATH might
> change, and, even if it did not, it would be possible to link an
> application with a library in, say, /usr/local/lib, and then find out
> that at run-time it loads a library with the same name in /usr/lib,
> because /usr/lib appears first in the standard search path.
I still support my proposal.
We have the same problem with the -L option and we
can't do anything against it.
For example, if you link with "-L/usr/local/lib -lfoo -L/usr/lib -lbar"
the linker might link the library libbar in /usr/local/lib instead
of the one in /usr/lib.
AFAIK there's no clean and portable way to avoid this.
So _the user_ has to ensure that this won't happen.
If it's impossible for -L, then it's not necessary for -rpath.
--
Thomas Tanner ----------------------------------------
email: tanner@(gmx.de|ggi-project.org|gnu.org|mucl.de)
web: http://home.pages.de/~tanner
visit: www.ggi-project.org www.gnustep.org
Reply to: