Crossing gcc to my new system

Kai Ruottu karuottu@freenet.hut.fi
Fri Oct 1 00:00:00 GMT 1999


On Tue, 24 Aug 1999 22:47:15 -0100, Ross Vandegrift <ross@seitz.com>
wrote:

>So I installed what one might call a "development" suite subset of
>Slackware 4.0 on a spare partition, and began compiling cross compilers
>to generate i586-pc-linux-gnu code on an i586-pc-linux-gnulibc1 machine.

 As I understand, you installed a 'native i586-pc-linux-gnu'
host/target toolset on a 'i586-pc-linux-gnulibc1' host ?  And not
booted the libc6-based Slackware 4.0 first?

>The cross compiling of basic programs worked fairly well - as I expected
>it too.  Kinda just like before, but I had to set up configure to call my
>cross compiler instead.

 You don't now have a cross-compiler, but a native 'i586-linux-gnu'
toolset running under a 'i586-linux-gnulibc1' system... The
libc6-binaries can be run under a libc5-based system, if the shared
libs and the dynamic linker for libc6 are added on the libc5 system...
This is just the same kind of thing as running SCO 3.2 or SVR4
binaries under the Linux-ibcs2-emulation.

> Now I have a usable system up, with the exception of gcc. gcc is being a
>real pain.I tried the obvious thing first - configuring it straight up as
>a native compiler,

More obvious and following the general rules about building binaries
for a 'foreign system' (as the libc6-based system is for the
libc5-based one), would have been first to configure it as a
Linux-libc5-to-Linux-libc6 cross-compiler:

  --build=i586-linux-gnulibc1 --host=i586-linux-gnulibc1 \
  --target=i586-linux-gnu --enable-shared

install the target system's glibc-2.x headers and libs at:

  /usr/local/i586-linux-gnu/...

and write 'make', using your native GCC to produce the
'i586-linux-gnu' target toolset...  Should have worked, if you just
had copied the 'ld-linux.so.2' into '/lib' too (linking libc6-binaries
needs it too). The resulted toolset would then have been produced as
the native libc5-binaries...

>Then, I tried to let it pick the compiler, but send it a full
>build/host/target set (ie: `../configure --enable-shared
>--build=i586-pc-linux-gnulibc1 --host=i586-pc-linux-gnu
>--target=i586-pc-linux-gnu), but this time it produced gencheck and
>similar programs that dumped core - obviously leading to no success.

 You tried to make a native GCC for 'i586-pc-linux-gnu' on a
'i586-pc-linux-libc1' build machine. To get this happen, you should
have the 'i586-linux-gnulibc1-to-i586-linux-gnu' cross-compiler (the
GCC-driver having the name 'i586-pc-linux-gnu-gcc') already built and
ready. Then this could have happened nicely... The situation is quite
the same as building a native Win32, DOS, FreeBSD etc. compiler under
Linux...

>So, my question remains; how can I get a working gcc into my new
>system?

 Building first a libc5-hosted and libc6-targeted toolset, and using
it to produce a native libc6-host/target toolset... This is how one
does it following the general rules...

 Trying straight an old libc6-host/target compiler as the 'bootstrap'
compiler may cause many troubles... But telling a pure lie to your
(stupid?) machine and saying that it is a 'i586-pc-linux-gnu' system
(although it isn't...) and giving the command:

./configure --build=i586-pc-linux-gnu --host=i586-pc-linux-gnu \
--target=i586-pc-linux-gnu --enable-shared

may work somehow (If it believes what you write...). But then
it may take the native libc5 headers in '/usr/include', not the libc6
ones in '/usr/local/i586-pc-linux-gnu/include', and try to fix them
etc.  This can be a much harder way that just 'following the rules' --
one must now know the configure-system quite well.

Cheers, Kai



More information about the Gcc-help mailing list