[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: new autoconf/libtool

From: Mo DeJong <supermo_at_bayarea.net>
Date: 2001-09-23 01:44:04 CEST

On Sat, 22 Sep 2001 03:24:42 -0700
Greg Stein <gstein@lyra.org> wrote:

> Hey all,
>
> I've been working with Mo's patch and trying to get this stuff to work. I've
> got it, but I had to work around a libtool bug to do so.
>
> There were also quite a few changes over Mo's patch that I made (his patch
> did not reference the .la files directly, but libtool 1.4 was meant to do
> exactly that; thus no need for -L -l pairs).
>
> The bug is related to libtool's desire to relink libraries at install time.
> It does this to adjust the --rpath stuff (when you compile it, --rpath
> points into the build dir; at install time, it is relinked to toss that).
> When it does the relink, it improperly does a "cd" which then screws up the
> following commands. My patch was to rewrite the .la files to include proper
> relink commands. Mebbe if I was smarter, we could patch the generated
> "libtool" script.
>
> Anyways... since I feel this is a bit tweaky, I wanted to post before
> committing. Especially if anybody knows some fixes for the relink problem.
>
> I'm using libtool 1.4.2 and autoconf 2.52
>
> Cheers,
> -g

I have been able to reproduce this problem on my Linux box. This sort
of problem does not seem to show up when using automake since
it always works from the current directory. The reason this is blowing
up is because of an install line like so:

libtool --mode=install install -c subdir/libdemo.la /tmp/demo/libdemo.la

If this libdemo depends on another libtool library it will blow up because
it does a cd to "subdir" and does no cd back to the current dir inside the
libtool script.

I have attached a very small example that reproduces this error,
the following files are included in the .tgz.

libtool (Generated under Linux: grab new one from svn/trunk on your system)
subdir
subdir/bug.c
subdir/demo.c
ltmain.sh
runlt.sh

This will try to create a libtool archive named subdir/libdemo.la and install
it (which fails).

I poked around in the libtool 1.4.2 release and created the following patch
to fix this problem.

--- copy_ltmain.in Sat Sep 22 16:12:27 2001
+++ ltmain.in Sat Sep 22 16:12:38 2001
@@ -4159,10 +4159,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

I am going to go ahead and send this to the libtool list so that it will
be incorporated into the next libtool release.

In the mean time, we have a couple of options:

1) Disable shared builds.
2) Tell users to apply the above patch to the libtool 1.4.2 release.
3) Change the INSTALL targets so they do a cd before installing.

Option 3 might be the least painful. The build-outputs.mk file INSTALL
targets would need to change:

$(INSTALL_MOD_STATIC) subversion/libsvn_delta/libsvn_delta.a $(APACHE_TARGET)/libsvn_delta.a

Would become:

cd subversion/libsvn_delta ; $(INSTALL_MOD_STATIC) libsvn_delta.a $(APACHE_TARGET)/libsvn_delta.a

cheers
Mo DeJong

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Sat Oct 21 14:36:42 2006

This is an archived mail posted to the Subversion Dev mailing list.