On 03/18/2013 02:54 PM, Ian Lance Taylor wrote:
On Mon, Mar 18, 2013 at 6:33 AM, Sam Thursfield
<sam.thursfield@xxxxxxxxxxxxxxx> wrote:
Could someone explain how GCC can be cross-built for new architectures now
that it requires C++ to build? It seems to be that there is the following
dependency loop:
- Building libstdc++ for target requires a libc for the target
- Building libc for target requires a gcc for target
- Building gcc for target requires at least a g++ that cross-compiles
- The cross-g++ for the target requires a libstdc++ built for the target
For architectures that GCC is already built for, I hear that this will be
solved by ensuring GCC version N can be built by version N-1. But how will
this work for a new architecture, which doesn't yet have a GCC built for it?
Normally compilers for new architectures are initially built as
cross-compilers. So the procedure is:
* Build cross-GCC for target using host libstdc++
* Use cross-GCC to build libc for target
* Use cross-GCC to build libstdc++ for target
* Use cross-GCC, libc, libstdc++ to build native GCC for target
Oh, I see where I was getting confused. We need libstdc++ built for the
target to build C++ executables for the target, but we don't need it to
build libc or libstdc++. And once we have those, we have all we need to
build a native GCC.
Thanks!
Sam