Test case:
- library foo2 depend from foo1
- program foo depend from foo2 (that depend from foo1)
- library foo3 depend from foo2 (that depend from foo1)
(test case attached as file bootstrap.sh.gz)
On mingw (cross-compilation) the program foo is linked but library
foo3 fail.
Mingw (--prefix=/tmp/test/foo/mingw):
1.1) program foo:
$ /bin/sh ./libtool --tag=CC --mode=link i386-mingw32msvc-gcc -g
-O2 -no-undefined -avoid-version -o foo.exe foo.o lib2/libfoo2.la
....
$ i386-mingw32msvc-gcc -g -O2 -o .libs/foo.exe foo.o
lib2/.libs/libfoo2.dll.a
/<ABSPATH>/build-mingw/lib1/.libs/libfoo1.dll.a
-L/tmp/test/foo/mingw/lib
1.2) library foo3:
$ /bin/sh ../libtool --tag=CC --mode=link i386-mingw32msvc-gcc -g
-O2 -no-undefined -avoid-version -o libfoo3.la -rpath
/tmp/test/foo/mingw/lib foo.lo ../lib2/libfoo2.la
....
i386-mingw32msvc-gcc -shared .libs/foo.o ../lib2/.libs/libfoo2.dll.a
-L/<ABSPATH>/build-mingw/lib1/.libs -o .libs/libfoo3.dll
-Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker
.libs/libfoo3.dll.a
....
.libs/foo.o: In function `foo3':
..../lib3/foo.c:6: undefined reference to `_foo1'
Similar but on linux (--prefix=/tmp/test/foo/linux):
2.1) program foo:
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o foo foo.o
lib2/libfoo2.la
gcc -g -O2 -o .libs/foo foo.o lib2/.libs/libfoo2.so
/<ABSPATH>/build-linux/lib1/.libs/libfoo1.so -Wl,--rpath
-Wl,/tmp/test/foo/linux/lib
2.2) library foo3:
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -o libfoo3.la
-rpath /tmp/test/foo/linux/lib foo.lo ../lib2/libfoo2.la
...
gcc -shared .libs/foo.o -Wl,--rpath
-Wl,/<ABSPATH>/build-linux/lib2/.libs -Wl,--rpath
-Wl,/tmp/test/foo/linux/lib ../lib2/.libs/libfoo2.so
-L/<ABSPATH>/build-linux/lib1/.libs -Wl,-soname -Wl,libfoo3.so.0 -o
.libs/libfoo3.so.0.0.0
Common is that when link programs all dep-libs are expanded and passed
to compiler as non-installed dependent are with absolute path.
If is linked library direct dependent lib and path to indirect are
passed to compiler but indirect library is missing on command line.
Roumen