I have a bit of a conundrum - I am trying to build native cross compiler
which allows me to compile software which is able to run on 3 platforms:
x86_64, i585(i686) and powerpc (G2).
The host environment is x86_64, though as native compiler it should not
use anything from that environment when compiling the software, or at
least I would like to avoid that as much as possible. One other thing of
note is that during the software-building process the whole environment
will be chroot-ed. In the complete image file when the software is built
there should also be natively-built GCC compiler for the target
environment (i586/i686 and powerpc).
This used to be pretty straight-forward when host and target platforms
are the same (3-stage bootstrap, chroot to the target environment image
and then use the freshly-built GCC to compile the rest of the software),
but I now have the new task of getting a native cross-compiler built to
take advantage of the processing power in the host environment, which is
x86_64 (quad core CPUs).
I have read the help pages (http://gcc.gnu.org/install/build.html) and
particularly the 2 sections "Building a native compiler" and "Building a
cross compiler", but there are things in it which aren't very clear to me.
The "Building a cross compiler" section suggests that 3-stage
bootstrapping is not possible and recommends building and installing
(presumably in the chrooted environment) a native compiler which is then
used to build the cross compiler (at least that is my interpretation of
this).
1. Does that mean that I should follow the steps in the previous section
("Building a native compiler"), use the 3-stage bootstrapping and after
this use the resulting compiler to build another GCC cross compiler
(including the appropriate toolchain) for the 3 architectures I am
interested in and use this compiler to build my software?
2. I am also assuming that the native GCC compiler which builds the
native cross-compiler needs to be for the host environment (x86_64) or
have I got this wrong?
3. If that is the case what steps should I use to build the GCC compiler
for the target image architectures (powerpc and i586/i686)?
4. Further in that section ("Building a cross compiler") there is
reference in it which advices that after building the native compiler I
should configure the cross compiler and then issue 'make' which will
automatically build the 'host' tools (host as in the 'host'
architecture?!) necessary to build the compiler as well as the 'target'
tools for use of the compiler (again, I assume target as in the 'target'
architectures I am interested in), then build the compiler itself
(single-stage only) and "Build runtime libraries using the compiler from
the previous step". That last bit isn't completely clear to me - what
previous step?
5. I assume at the end of this process I will end up with my native
cross compiler which I could then use to build my software. Do I need to
do anything else?
6. Also, later in that section I am advised that for building the
binutils (which I would need to anyway!) I need to use the same --host
and --target that are used for configuring GCC, but which one - the
native cross-compiling GCC or the one that helped build it?
Many thanks in advance for any guidance with regards to this!
MZ