[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libtool 2.2.6] linking -static with uninstalled shared library gene
From: |
Ralf Wildenhues |
Subject: |
Re: [libtool 2.2.6] linking -static with uninstalled shared library generates invalid rpath |
Date: |
Wed, 4 Nov 2009 20:36:35 +0100 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
Hello Stanislav,
* Stanislav Brabec wrote on Wed, Nov 04, 2009 at 07:38:34PM CET:
> Bob Friesenhahn wrote:
> > On Wed, 4 Nov 2009, Stanislav Brabec wrote:
> >
> > > When linking a binary which contains -static in its LDFLAGS and the
> > > library is linked against an uninstalled library which does not contain
> > > -static in its LDFLAGS and configure was called with --disable-static,
> > > libtool generates invalid command line that embeds RPATH to the
> > > uninstalled shared library location.
>
> > Is this true after the library/program has been installed with libtool
> > using --mode=finish?
>
> Yes:
Thanks for the bug report. Confirmed. Below is a test case to expose
it.
Cheers,
Ralf
2009-11-04 Stanislav Brabec <address@hidden>
Ralf Wildenhues <address@hidden>
* tests/static.at (--tag=disable-static and -static): New test.
diff --git a/tests/static.at b/tests/static.at
index f59b124..2cd09e2 100644
--- a/tests/static.at
+++ b/tests/static.at
@@ -376,3 +376,47 @@ AT_CHECK([$LIBTOOL --mode=link --tag=CC ./ccache $CC
$CFLAGS $LDFLAGS -all-stati
[], [ignore], [ignore])
AT_CLEANUP
+
+
+AT_SETUP([--tag=disable-static and -static])
+AT_KEYWORDS([libtool])
+dnl AT_XFAIL_IF([:])
+
+inst=`pwd`
+libdir=$inst/lib
+bindir=$inst/bin
+mkdir $inst $libdir $bindir
+
+AT_DATA([liba.c],
+[[int a (void) { return 0; }
+]])
+
+AT_DATA([main.c],
+[[extern int a (void);
+int main (void) { return a (); }
+]])
+
+AT_CHECK([$LIBTOOL --features | grep enable.shared || exit 77],
+ [], [ignore])
+
+eval `$LIBTOOL --config | $EGREP '^(OBJDUMP)='`
+AT_CHECK([$LIBTOOL --tag=disable-static --mode=compile $CC $CPPFLAGS ]dnl
+ [$CFLAGS -c liba.c], [], [ignore], [ignore])
+
+AT_CHECK([$LIBTOOL --tag=disable-static --mode=link $CC $CFLAGS ]dnl
+ [$LDFLAGS -rpath $libdir -o liba.la liba.lo],
+ [], [ignore], [ignore])
+
+AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c], [], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --tag=disable-static --mode=link $CC $CFLAGS $LDFLAGS ]dnl
+ [-static -o main main.$OBJEXT liba.la], [], [ignore], [ignore])
+
+AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir],
+ [], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --mode=install cp main$EXEEXT $bindir],
+ [], [ignore], [ignore])
+
+AT_CHECK([$OBJDUMP -p $bindir/main$EXEEXT | $EGREP -i "R(UN)?PATH.*$DESTDIR"],
+ [1])
+
+AT_CLEANUP