[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Coding absolute paths into shared libraries

From: Wolfgang Bangerth
Subject: Coding absolute paths into shared libraries
Date: Tue, 12 Feb 2002 13:47:22 +0100 (MET)

Hi there,
in developing the deal.II library [1], we usually have several checked-out
trees in our directories (e.g. one with CVS HEAD, one with a branch, and
one configured to use an obscure 3rd party lib). Likewise, in parallel
directories, we have several copies of our application programs. Since we
do not want to set and reset LD_LIBRARY_PATH each time we run one of the
copies of the applications, we link them to the library using absolute

Now, I'd like to convert the build process of the library to use libtool.
But linking the lib with libtool strips the abolute paths since libtool
uses  "-Wl,-soname -Wl,", but "libname" without path info.

Now, I link my program (simplified case) like that:
  gcc /path/to/lib/
Funny enough, if I do an ldd on the executable, I see
  ldd main => not found
Why? Because libtool aliases the library's name to ""
through the -soname command on the linker line, i.e. although I specified
the full path of the library on the link line, ld drops it in favor of
the stored soname which did not include the path. But since the
LD_LIBRARY_PATH does not include the path to the lib, ldd/ can't find
the pointed to library.

The question now is:
1/ Can I turn off this unwanted insertion of -soname on the linker line?
   (Why is it there anyway?)
2/ If not, can I convince libtool to use a global name, i.e. including
   full path information?
3/ If not, is there a way to override the soname specified by libtool?
   I tried appending "-Wl,-soname -Wl,/path/to/lib/", but
   that only made libtool drop the second -Wl,... and results in two
   -Wl,-soname's, which the linker did not like.

Regards + thanks for your help


Wolfgang Bangerth          email: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]