Cross linking our Ch5 build against a new glibc

Greg Schafer gschafer at
Sun Jan 19 19:24:46 PST 2003

On Mon, Jan 20, 2003 at 10:03:16AM +1100, Ryan.Oliver at wrote:
> So Greg, you are absolutely correct, to build a cross linker all we have to
> do is specify --with-lib-path during configure :-)

Yes, but...

It seems to me that we don't really need a cross linker. I know that you've
based your stuff on Bruno Haible's post but from what I can tell, the
current tools just work! gcc-3.2.1 (installed into /static) seems to be
smart enuff to drag in everything (except for the dynamic linker directive)
from /static

Witness the following. This is with binutils NOT tweaked:-
tigers-lfs:/static/src# gcc -v foo.c
Reading specs from /static/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs
Configured with: ../gcc-3.2.1/configure --prefix=/static
--enable-languages=c --disable-nls --disable-shared --with-ld=/static/bin/ld
Thread model: posix
gcc version 3.2.1
 /static/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/cc1 -lang-c -v -D__GNUC__=3
-Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__
-D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__
-D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__
-D__tune_i686__ -D__tune_pentiumpro__ foo.c -quiet -dumpbase foo.c -version
-o /tmp/ccFbi9fU.s
GNU CPP version 3.2.1 (cpplib) (i386 Linux/ELF)
GNU C version 3.2.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.2.1.
ignoring nonexistent directory "/static/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /static/bin/as -V -Qy -o /tmp/ccIsZiKI.o /tmp/ccFbi9fU.s
GNU assembler version (i686-pc-linux-gnu) using BFD version 20021126
 /static/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/collect2 --eh-frame-hdr -m
elf_i386 -dynamic-linker /static/lib/
-L/static/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/../../.. /tmp/ccIsZiKI.o -lgcc
-lc -lgcc /static/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/crtend.o

Notice the last "-L" statement? It is actually pointing to the dir where all
our libs that we want to link against are.

Note also the include search order, which although it searches
/usr/local/include first, it then searches /static/include which is what we
want. I'm not sure if searching /usr/local/include first could be harmful or
> This makes life nice and easy, just leaves us with the hack to modify
> --dynamic-linker in gcc

Yes, but I again think you might be approaching this the hard way. gcc
provides a "specs" file for exactly this sort of thing. All I did was tweak
the file:-


and changed the reference of /lib/ to /static/lib/

and everything just worked! But your way probably achieves exactly the same

Anyway, I'm still playing around and experimenting. I haven't even entered
the chroot yet and I still have some reservations about how stuff will work
in there. We'll see..


PS - when you are you going to start using a decent mail reader that doesn't
mangle the threads? Bloody Lotus Bloats :-)
Unsubscribe: send email to listar at
and put 'unsubscribe lfs-dev' in the subject header of the message

More information about the lfs-dev mailing list