[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Libtool problem with shared lib in non-standard directory
From: |
Marcel Loose |
Subject: |
Libtool problem with shared lib in non-standard directory |
Date: |
Thu, 26 Jan 2006 11:07:02 +0100 |
Hi,
I orginally posted this
http://lists.gnu.org/archive/html/bug-libtool/2006-01/msg00001.html mail to the
address@hidden It seems to be a bug in libtool. Hence, I will try to provide
some extra information.
I have a package "Common" that (optionally) uses the 3rd party package
Boost.Threads (and log4cplus). Another package "Blob" depends on "Common".
Whenever I try to run the test (using make check) on the "Blob" test programs I
get an "error while loading shared libraries ...". For some reason libtool does
not add a "-Wl,-rpath" on the link line
$ automake --version
automake (GNU automake) 1.9.5
Written by Tom Tromey <address@hidden>.
Copyright 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ libtool --version
ltmain.sh (GNU libtool) 1.5.18 (1.1220.2.245 2005/05/16 08:55:27)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ --version
g++ (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
After succesfully building and installing the "Common" package the libtool
library contains the following ...
$ cat /home/loose/LOFAR/installed/gnu_debug/lib/libcommon.la
# libcommon.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.18 (1.1220.2.245 2005/05/16 08:55:27)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libcommon.a'
# Libraries that this one depends upon.
dependency_libs=' -R/usr/local/log4cplus/gnu/lib -R/usr/local/boost/gnu/lib
-L/usr/local/log4cplus/gnu/lib -L/usr/local/boost/gnu/lib
/home/loose/LOFAR/installed/gnu_debug/lib/libshmem.la
/usr/local/log4cplus102P1/gcc322/lib/liblog4cplus.la -lpthread -lrt
-lboost_thread-gcc-mt'
# Version information for libcommon.
current=0
age=0
revision=0
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/home/loose/LOFAR/installed/gnu_debug/lib'
Note that "-R /usr/local/boost/gnu/lib" is clearly present in the
dependency_libs.
Continuing to build the "Blob" package ... . After a successful build of this
package, the libtool library contains the following ...
$ cat /home/loose/LOFAR/LCS/Blob/build/gnu_debug/src/libblob.la
# libblob.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.18 (1.1220.2.245 2005/05/16 08:55:27)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libblob.a'
# Libraries that this one depends upon.
dependency_libs=' -R/usr/local/log4cplus/gnu/lib
-R/home/loose/LOFAR/installed/gnu_debug/lib -R/usr/local/boost/gnu/lib
-L/usr/local/log4cplus/gnu/lib -L/home/loose/LOFAR/installed/gnu_debug/lib
/usr/local/log4cplus/gnu/lib/liblog4cplus.la
/home/loose/LOFAR/installed/gnu_debug/lib/libcommon.la
-L/usr/local/boost/gnu/lib
/home/loose/LOFAR/installed/gnu_debug/lib/libshmem.la
/usr/local/log4cplus102P1/gcc322/lib/liblog4cplus.la -lpthread -lrt
-lboost_thread-gcc-mt'
# Version information for libblob.
current=0
age=0
revision=0
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/home/loose/LOFAR/installed/gnu_debug/lib'
Again, "-R/usr/local/boost/gnu/lib" is present in the dependency libs.
However, when trying to run any of the test programs (using make check) I get
errors like:
./tKeyValueMap: error while loading shared libraries:
libboost_thread-gcc-mt-1_32.so.1.32.0: cannot open shared object file: No such
file or directory
So, what does the link line look like. For this, I deleted tKeyValueMap and
rebuild (i.e. relinked it) it by running make in the test directory.
$ cd /home/loose/LOFAR/LCS/Blob/build/gnu_debug/test && make tKeyValueMap
/bin/sh ../libtool --tag=CXX --mode=link /usr/bin/g++ -g -W -Wall
-Woverloaded-virtual -Wno-unknown-pragmas -pthread
-L/usr/local/log4cplus/gnu/lib -R/usr/local/log4cplus/gnu/lib
-L/home/loose/LOFAR/installed/gnu_debug/lib
-R/home/loose/LOFAR/installed/gnu_debug/lib -o tKeyValueMap tKeyValueMap.o
../src/libblob.la -llog4cplus -lcommon
/usr/bin/g++ -g -W -Wall -Woverloaded-virtual -Wno-unknown-pragmas -pthread -o
tKeyValueMap tKeyValueMap.o -L/usr/local/log4cplus/gnu/lib
-L/home/loose/LOFAR/installed/gnu_debug/lib ../src/.libs/libblob.a
-L/usr/local/boost/gnu/lib
/home/loose/LOFAR/installed/gnu_debug/lib/libcommon.a
/home/loose/LOFAR/installed/gnu_debug/lib/libshmem.a
/usr/local/log4cplus102P1/gcc322/lib/liblog4cplus.so -lpthread -lrt
-lboost_thread-gcc-mt -Wl,--rpath -Wl,/usr/local/log4cplus102P1/gcc322/lib
-Wl,--rpath -Wl,/usr/local/log4cplus102P1/gcc322/lib -Wl,--rpath
-Wl,/usr/local/log4cplus/gnu/lib -Wl,--rpath
-Wl,/home/loose/LOFAR/installed/gnu_debug/lib
As can be seen, libtool uses ../src/libblob.la on the link line. So, if my
understanding of how libtool should work is correct, then libtool should add
the "-R /usr/local/boost/gnu/lib", translating this into something "-Wl,
--rpath,/usr/local/boost/gnu/lib". This, however, does not happen, as can be
clearly seen from the expanded command line above., and ldd proves that
something is wrong.
$ ldd tKeyValueMap
liblog4cplus.so.2 =>
/usr/local/log4cplus102P1/gcc322/lib/liblog4cplus.so.2 (0x40017000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4007f000)
librt.so.1 => /lib/librt.so.1 (0x4008c000)
libboost_thread-gcc-mt-1_32.so.1.32.0 => not found
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4009f000)
libm.so.6 => /lib/tls/libm.so.6 (0x40152000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40174000)
libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Am I missing something here, or is this a bug???