Kurt Roeckx <[EMAIL PROTECTED]> writes:

> After reading bug #291641, I'd have to agree this is a problem
> with the linker.

It's not quite so clear to me.  Here's the script I've been using to
duplicate the problem:

#!/bin/bash

rm -rf zz
mkdir zz zz/i zz/j zz/k zz/lib zz/bin
R="-rpath $PWD/zz/lib"

echo "int this_is_i() { return 0; }"           > zz/i/i.c
echo "int this_is_j() { return this_is_i(); }" > zz/j/j.c
echo "int main() { return this_is_j(); }"      > zz/k/k.c

libtool --mode=compile gcc -c zz/i/i.c -o zz/i/i.lo
libtool --mode=compile gcc -c zz/j/j.c -o zz/j/j.lo
libtool --mode=compile gcc -c zz/k/k.c -o zz/k/k.lo
libtool --mode=link    gcc zz/i/i.lo              -o zz/i/libi.la $R
libtool --mode=link    gcc zz/j/j.lo zz/i/libi.la -o zz/j/libj.la $R
libtool --mode=link    gcc zz/k/k.lo zz/j/libj.la -o zz/k/k
echo "== first build complete"

libtool --mode=install cp zz/i/libi.la $PWD/zz/lib > /dev/null
libtool --mode=install cp zz/j/libj.la $PWD/zz/lib > /dev/null
libtool --mode=install cp zz/k/k       $PWD/zz/bin > /dev/null
echo "== install complete"

echo ldd zz/k/k
libtool --mode=execute ldd zz/k/k
echo ldd zz/bin/k
libtool --mode=execute ldd zz/bin/k
echo "== first build checked"

echo "int this_is_xi() { return 0; }"           > zz/i/i.c
echo "int this_is_j() { return this_is_xi(); }" > zz/j/j.c

libtool --mode=compile gcc -c zz/i/i.c -o zz/i/i.lo
libtool --mode=compile gcc -c zz/j/j.c -o zz/j/j.lo
libtool --mode=link    gcc zz/i/i.lo              -o zz/i/libi.la $R
libtool --mode=link    gcc zz/j/j.lo zz/i/libi.la -o zz/j/libj.la $R
libtool --mode=link    gcc zz/k/k.lo zz/j/libj.la -o zz/k/k
echo "== second build failed"

rm -rf zz/lib/* zz/bin/*
echo "== uninstall complete"

libtool --mode=link    gcc zz/k/k.lo zz/j/libj.la -o zz/k/k       $R
echo "== third build complete"

echo ldd zz/k/k
libtool --mode=execute ldd zz/k/k
echo "== third build checked"


It's the second build that fails, when this libtool command:

libtool --mode=link    gcc zz/k/k.lo zz/j/libj.la -o zz/k/k

invokes this gcc command:

gcc zz/k/.libs/k.o -o zz/k/.libs/k  zz/j/.libs/libj.so  -Wl,--rpath 
-Wl,/home/pm/sw/zz/lib

Note the --rpath to the install directory, that goes straight through
to the linker, and it appears that the command line option overrides
RPATH in the library.  Is it a linker bug for the command line option
to have priority?  I don't know.

Perhaps libtool should not be passing that --rpath during the link?
Perhaps libtool should be passing the build dir instead?  (That might
mean that libtool has to relink the executable at install time to get
the correct final rpath.)  Does that make it a libtool bug?

-- 
Philip Martin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to