Dan Nicholson wrote:
> On 12/20/06, Joe Ciccone <[EMAIL PROTECTED]> wrote:
>> >
>> I've been playing around with libtool for the past 3 days and have not
>> come up with something working yet. This little script is so complex, it
>> is such a pain to modify or even figure out what the heck it's doing. I
>> just hope this doesn't take as long as it did to figure out the locales.
>
> Joe, I was reading the libtool archives today, and I think I have an
> idea how they work now and might have an idea for a working hack.
>
> Anyway, configure and ltmain.sh work together to generate the libtool
> script at build time. ltmain.sh is generated by libtoolize and
> libtool.m4 by the developer. But, you can patch it at build time like
> Makefile.in. That way, you can force in options that libtool would
> otherwise not know how to handle, like --sysroot.
>
> For instance:
>
> sed -i.bak 's%compiler_flags=$%&"--sysroot=/foo/bar"%' ltmain.sh
>
> That would make the first empty compiler_flags have --sysroot instead.
> For my boring old native compiler, it made things break, but you can
> see that the option got in there.
>
> /bin/sh ../libtool --tag=CC --mode=link gcc  -g -O2   -o
> libpaco-log.la -rpath /usr/lib  libpaco_log_la-log.lo  -ldl
> gcc -shared  .libs/libpaco_log_la-log.o  -ldl --sysroot=/foo/bar
> -Wl,-soname -Wl,libpaco-log.so.0 -o .libs/libpaco-log.so.0.0.0
>
> Does that help at all?
Well, there's no need to pass --sysroot= to gcc as it is already there.
When the cross-compiler is built it's hardwired into the default specs.

*sysroot_spec:
--sysroot=%R

The problem is that the .la files it produces contain full paths. Fine
for cross-compiling on the host system. But not for compiling on the
target system. Example, /usr/lib/libstdc++.la on the target system has,

dependency_libs=' -lm -lm -lm
-L/mnt/clfs-arm/cross-tools/lib/gcc/arm-unknown-linux-gnu/4.1.1
-L/mnt/clfs-arm/cross-tools/lib/gcc/arm-unknown-linux-gnu/4.1.1/../../../../arm-unknown-linux-gnu/lib
-L/mnt/clfs-arm/lib -L/mnt/clfs-arm/usr/lib
-L/mnt/clfs-arm/build/gcc-build/arm-unknown-linux-gnu/libstdc++-v3/src
-L/mnt/clfs-arm/build/gcc-build/arm-unknown-linux-gnu/libstdc++-v3/src/.libs
-lm -lm -lm -L/mnt/clfs-arm/build/gcc-build/./gcc
-L/mnt/clfs-arm/cross-tools/arm-unknown-linux-gnu/bin
-L/mnt/clfs-arm/cross-tools/arm-unknown-linux-gnu/lib -lgcc_s -lc
-lgcc_s -lm -lgcc_s -lc -lgcc_s -lm -lm -lm -lgcc_s -lc -lgcc_s -lm
-lgcc_s -lc -lgcc_s -lm -lgcc_s -lc -lgcc_s -lm
/mnt/clfs-arm/cross-tools/arm-unknown-linux-gnu/lib/libstdc++.la -lm -lm
-lm -lgcc_s -lc -lgcc_s -lm -lgcc_s -lc -lgcc_s -lm -lgcc_s -lc -lgcc_s'

libasprintf.la libbfd.la and libsupc++.la all have similar lines.

This is the difference between the cross-compiled .la and the natively
compiled .la : http://pastebin.cross-lfs.org/422

Libtool itself needs to take into account sysroot so it looks in the
proper places for libraries. The libdir='/usr/lib' at the bottom of each
cross-compiled .la file causes -L/usr/lib to appear when
cross-compiling. If libtool read libdir='/usr/lib' and added
-L$SYSROOT/usr/lib there wouldn't be any errors.

I hope this clears up what the biggest problem is.
_______________________________________________
Clfs-dev mailing list
[email protected]
http://lists.cross-lfs.org/cgi-bin/mailman/listinfo/clfs-dev

Reply via email to