bug-libtool
[Top][All Lists]
Advanced

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

Re: Libtool problem with shared lib in non-standard directory


From: Ralf Wildenhues
Subject: Re: Libtool problem with shared lib in non-standard directory
Date: Thu, 26 Jan 2006 18:29:43 +0100
User-agent: Mutt/1.5.11

> * Marcel Loose wrote on Thu, Jan 26, 2006 at 11:07:02AM CET:
> >  
> > 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 

Confirmed, testcase below.

Note also behavior and documentation differ in another way: for the second
library, the run-time path is actually added, cf. libtool.info:

| `-R LIBDIR'
|      If OUTPUT-FILE is a program, add LIBDIR to its run-time path.  If
|      OUTPUT-FILE is a library, add `-RLIBDIR' to its DEPENDENCY_LIBS,
|      so that, whenever the library is linked into a program, LIBDIR
|      will be added to its run-time path.

Cheers,
Ralf


# 1. install a non-libtool library liba in some directory
# 2. create libtool library libb (to be installed somewhere else),
#    depending on liba, with -R added suitably
# 3. create program depending on libb

: ${LIBTOOL=libtool}
: ${CC=gcc}
LDFLAGS="$LDFLAGS -no-undefined"
libdir_a=`pwd`/inst_a
libdir_b=`pwd`/inst_b
rm -rf src $libdir_a $libdir_b
mkdir src $libdir_a $libdir_b
cd src

echo 'int a() { return 0; }' > a.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la -rpath $libdir_a a.lo
$LIBTOOL --mode=install cp liba.la $libdir_a/liba.la
$LIBTOOL --mode=clean rm -f liba.la
rm -f $libdir_a/liba.la

echo 'extern int a(); int b() { return a(); }' > b.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la -rpath $libdir_b \
        b.lo -L$libdir_a -la -R$libdir_a

echo 'extern int b(); int main() { return b(); }' > m.c
$CC $CPPFLAGS $CFLAGS -c m.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m m.o libb.la
./m

cd ..




reply via email to

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