cross-compiling for arm-uknown-linux-gnueabi: libcc vs glibc

Kai Ruottu kai.ruottu@wippies.com
Thu Dec 1 22:39:00 GMT 2011


1.12.2011 21:30, Joel Reymont kirjoitti:

> I'm trying to build a cross-compilation toolchain with gcc-4.6.2
> and glibc-2.14. I'm on the Mac and using arm-uknown-linux-gnueabi
> as a target.
>
> I have Linux headers on the machine and was able to build the first stage of gcc.

They are different for each CPU arch, no "cater them all"...

> I'm now stuck with glibc wanting libgcc and 'make all-target-libgcc' looking
> for pthreads.h which is part of glibc.
>
> Any suggestions on how to resolve this circular dependency?

Normally there is no "circular dependency" in a cross GCC build,
neither in a native GCC build, some people only imagine there
being with cross GCCs...

In a native Linux GCC build the target C library is in '/lib',
'/usr/include' and '/usr/lib'. Sometimes some parts of it are
missing (the development ones) and one must install them.

In a Linux cross GCC build the target C library normally is in
'$sysroot/lib', '$sysroot/usr/include' and '$sysroot/usr/lib'.
As default the target C library is missing in the beginning so
one must first install it...

So what you are going to do with the cross GCC when it is ready:

1. compile apps etc for some existing 'arm-linux-gnueabi' system?

2. produce your own 'arm-linux-gnueabi' system from scratch?

Only the aim 1. could be called as "producing a cross compiler",
the aim 2. defines itself and "producing a cross compiler" is
only the "step 1" in a much longer process, involving first :

1. producing a cross compiler for the target

2. producing glibc with it for the target

3. compiling the Linux kernel and other root file system parts

The "from scratch" then is totally dependent on one's attitude!

If someone would ask how to produce a cross GCC for the current
Debian stable "arm-linux-gnueabi" distro, the instructions would
be very simple. But unfortunately the "attitude" will raise in
the simple question: "Could this be acceptable as the step 1 ?"
This is equivalent to questions like :

- is it allowable to use a hammer when making a hammer?

- is it allowable to use prebuilt GCC when producing GCC from
   its sources?

- is it allowable to drive with tyres to a tyre shop? Or go with
   a car to a car shop?

Believe me, there really are people who would say "NO!" to all
these questions :-(



More information about the Gcc-help mailing list