Chicken and eggs, aka. boot-gcc and real-gcc; why?
Jens Bauer
jens@plustv.dk
Sun Oct 16 15:41:00 GMT 2011
Hi everybody,
Excuse me for sounding stupid. I've wanted to ask this question for a long time.
I've been compiling avr-gcc with success, then avr-libc, which I understand that avr-gcc is using.
I've also tried compiling a few ARM toolchains; I've seen various different toolchains, and people talking about the chicken-and-egg problem.
To be frank (my name is Jens anyway), I'd like to ask for an explanation, that even I can understand.
Here's my current understanding of what's going on, and what's logically going on:
I'll start with a few #defines:
1: My native computer runs on the PowerPC architecture, we'll call this ARCH1.
2: A microcontroller I'm building a cross-compiler for runs on the ARM architecture, we'll call this ARCH2.
Here's what's going on:
1: First I use my native compiler, which is built to run on ARCH1 and produce code for ARCH1.
I use this compiler to produce a cross-compiler, which runs on ARCH1 and produces code for ARCH2.
2: I now use the cross compiler, to build a library (newlib) for ARCH2.
I'm told that this library is needed by the cross-compiler.
3: I then rebuild the cross-compiler, which *still* runs on ARCH1 and produces code for ARCH2.
This is done, because the cross-compiler needs the newlib library.
My stupid question is on its way.
What on earth does the cross-compiler need the library for; it cannot be linked to the library, right ??
We have two different architectures, and linking two architectures would produce incorrect code.
Actual question: If the cross-compiler is not linked to the library, how come the cross-compiler has to be rebuilt?
Please forgive me for being sceptical, but I believe that many people are spending a lot of extraneous extra compiling time...
And btw: The egg was before the chicken, if you ever wondered.
Proof: There were flies, lizards and snakes before the chicken, and they all lay eggs. ;)
Love,
Jens
More information about the Gcc-help
mailing list