Searching the mailing list, I've seen sporadic reports of libtool
relinking failures at install time. I've also seen it myself once. I
don't think anyone here has ever determined exactly what's going on,
except to note that it doesn't happen in very many circumstances.
I ran into the problem in my job and was forced to figure out what was
going on. Essentially, it's a known bug in some versions of libtool
which will bite you if all of the following are true:
* You are installing a package containing multiple interdependent
libraries (such as Subversion).
* You are installing into a DESTDIR area.
* You do not have any libraries previously installed in the final
$(libdir).
* You (or the tarball creator) did not libtoolize with a fixed
libtool. Debian-unstable and recent versions of Red Hat include
fixes in their libtool packages; some other OS distributions
presumably do so as well.
The bug is that, when relinking, libtool only instructs the linker to
look in $(libdir) for libraries, not in $(DESTDIR)$(libdir). Worse,
libtool doesn't error out when the relink fails; it just silently
declines to install a library, resulting in a partially populated
package.
Here is the fix from Red Hat 9.0's libtool SRPM, reformulated as a
diff against ltmain.sh. We might consider doing something to ensure
that this fix winds up in tarballs we distribute, but it would be
pretty ugly since the tarball creator's installed libtool might or
might not already have this fix.
diff -u -r1.2 ltmain.sh
--- ltmain.sh 5 Apr 2003 17:44:05 -0000 1.2
+++ ltmain.sh 5 Apr 2003 21:01:36 -0000
@@ -768,6 +768,7 @@
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
+ inst_prefix_dir=
avoid_version=no
dlfiles=
@@ -898,6 +899,11 @@
prev=
continue
;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
release)
release="-$arg"
prev=
@@ -999,6 +1005,11 @@
continue
;;
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
@@ -1893,7 +1904,16 @@
if test "$hardcode_direct" = yes; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ add_dir=
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="-L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add_dir="$add_dir -L$libdir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
@@ -1903,7 +1923,16 @@
add="-l$name"
else
# We cannot seem to hardcode it, guess we'll fake it.
- add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ add_dir=
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="-L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add_dir="$add_dir -L$libdir"
add="-l$name"
fi
@@ -3928,7 +3957,7 @@
fi
done
# Quote the link command for shipping.
- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
+ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
# Only create the output if not a dry run.
@@ -4229,12 +4258,30 @@
dir="$dir$objdir"
if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit 1
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+ fi
+
$echo "$modename: warning: relinking \`$file'" 1>&2
$show "$relink_command"
if $run eval "$relink_command"; then :
else
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- continue
+ exit 1
fi
fi
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Apr 5 23:30:50 2003