[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch for fix libtool when install does a relink.
From: |
Wonko The Sane |
Subject: |
Patch for fix libtool when install does a relink. |
Date: |
Sat, 22 Sep 2001 17:05:55 -0700 |
Hi all.
There is a small bug in libtool that only seems to show up
when running an install command like so:
libtool --mode=install install -c subdir/libdemo.la /tmp/demo/libdemo.la
This only happens when the relink_command inside the .la file
does a cd to some other directory. After the relink_command
is run the rest of the install will puke out. This also
only seems to happen when one .la file depends on another
.la file. Here is some example error output:
libtool: install: warning: relinking `subdir/libdemo.la'
cd /home/mo/project/build/libtool_full_bug/subdir; /bin/sh ../libtool
--mode=relink gcc -o libdemo.la -rpath
/home/mo/project/build/libtool_full_bug/install/lib demo.lo -L. -lbug
gcc -shared demo.lo -Wl,--rpath
-Wl,/home/mo/project/build/libtool_full_bug/install/lib
-L/home/mo/project/build/libtool_full_bug/subdir
-L/home/mo/project/build/libtool_full_bug/install/lib -lbug -Wl,-soname
-Wl,libdemo.so.0 -o .libs/libdemo.so.0.0.0
install -c subdir/.libs/libdemo.so.0.0.0T
/home/mo/project/build/libtool_full_bug/install/lib/libdemo.so.0.0.0
install: subdir/.libs/libdemo.so.0.0.0T: No such file or directory
The relink command in the .la file might look like so:
relink_command="cd /usr/build/foo ; /bin/sh /usr/foo/libtool ..."
That makes the next install fail since the CWD will then be /usr/build/foo.
In case anyone wants to try this out for themselves, I have
added a small .tar.gz file that includes a runlt.sh file.
Just run it and it will compile two .la files and install
them. The second install should fail and demonstrate the
bug.
The fix is really simple, just save the working directory
and reset it after running the relink_command. This patch
is for the current CVS head but this problem also exists
in the libtool 1.4.2 release.
cheers
Mo DeJong
2001-09-22 Mo DeJong <address@hidden>
* ltmain.in: Save the current working directory before
running a .la file's relink_command in case it changes
the current working directory.
Index: ltmain.in
===================================================================
RCS file: /cvs/libtool/ltmain.in,v
retrieving revision 1.278
diff -u -r1.278 ltmain.in
--- ltmain.in 2001/09/22 13:39:21 1.278
+++ ltmain.in 2001/09/22 23:01:17
@@ -4656,10 +4656,14 @@
dir="$dir$objdir"
if test -n "$relink_command"; then
+ # Save CWD in case the relink command changes it.
+ cwd=`pwd`
$echo "$modename: warning: relinking \`$file'" 1>&2
$show "$relink_command"
- if $run eval "$relink_command"; then :
+ if $run eval "$relink_command"; then
+ cd $cwd
else
+ cd $cwd
$echo "$modename: error: relink \`$file' with the above command
before installing it" 1>&2
continue
fi
libtool_full_bug.tgz
Description: GNU Zip compressed data
- Patch for fix libtool when install does a relink.,
Wonko The Sane <=