I am trying to use the sysroot capabilities of libtool to build a small root. However, I am running into problems with expansion of the sysroot in dependency_libs.
To illustrate my problem, here is an example. Imagine you have two libraries, liba and libb. liba is just a simple static library installed in the sysroot as $sysroot/prefix1/lib/liba.a. libb is a package using libtool configured with a sysroot value of $sysroot, and installed as $sysroot/prefix2/lib/libb.la
At this point, I see that libb.la
contains "dependency_libs='-L=/prefix1/lib -la'", which seems good to me so far.
However, when I try to build a program which uses libb, I run into trouble. If I run configure with the same sysroot value, and try to build, I see the following (actual sysroot path replaced with $sysroot):
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -L$sysroot/prefix2/lib -o c c.o -lb
libtool: link: gcc -g -O2 -o c c.o -L$sysroot/prefix2/lib $sysroot/prefix2/lib/libb.a -L=/prefix1/lib -la
ld: cannot find -la
collect2: error: ld returned 1 exit status
make: *** [c] Error 1
So it seems like libtool is not correctly expanding the -L=/prefix1/lib that comes from libb's dependency_libs. After some investigation, it looks like libtool expands '=/prefix1/lib' internally, and uses it to locate liba.a correctly. However, since it is not a libtool archive, it determines that it can just leave '-la' on the command line and continue normally. I would think that correct behaviour would be expanding -la to the full path to liba.a, or simply just expanding -L=/prefix/lib on the command-line, since it has determined that it can find -la using that expanded search path.
I believe this to be a bug in libtool, but I thought I'd ask to make sure I'm not missing something.
I have attached a small script that reproduces this problem.
Thanks for your help!
Michael Forney <address@hidden