Re: building native cross compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




1. The 'native' compiler (following the 3-stage bootstrap process as
described), which is placed 'somewhere' in my source tree and which
has the only task of building the cross compiler as described in step
2;

You don't really have to build this one, but it doesn't hurt.  It's not
place somewhere in your source tree.  It's actually built and installed
as usual.
I know, but GCC No 1 would have to be in a location within my source tree as it would form part of the entire build process when I start building the software, so it makes sense for me to place it somewhere sensible, inside of my source tree perhaps, so that it does not get confused with the GCC compiler which already exists on my host system.

From what I understand from your comments so far I have to do this:

1. download GCC source
2. build GCC 1 (native host - i.e. x86_64 - environment) following the 3-stage guide 3. then use GCC 1 to build GCC 2 and its toolchain (single stage, bootstrap disabled) which is for --host=x86_64 and target= either powerpc or i586/i686 (depending on the scenario I would need either of these architectures, but not both, hence this is one compiler with different cross-tool chains depending on the need I have). For this I guess I just need to run configure with the appropriate options (including --disable-bootstrap) and then make to finish the job. 4. use GCC 2 to build GCC 3 which would form part of the target software system allowing compilation of software for the target architecture only. I am still unclear as to whether I need to (or should!) use the 3-stage or single-stage path for this compiler. 5. use GCC 2 to build the rest of the software and create the final image which is then deployed to the target machine(s)

GCC1 & GCC 2 are 'temporary' and will be deleted before the final image is assembled. Also, the way I see it steps 3, 4 and 5 will be in chroot-ed environment as by then I will have a good, tested GCC built.

2. Cross compiler (single-stage?) which is able to compile for the two
target environments I am interested in - powerpc and i586/i686. Its
main task is to compile and build my software for the selected target
environment as well as building another GCC compiler (described in 3).

Yes.  If I'm following you correctly, which I may not be, then that is
two different cross-compilers, one for each target.
True, but if I need a compiler able to build on host=x86_64 and target=powerpc that's one (cross) compiler isn't it, I don't need to run the build process twice for that, do I or have I got this wrong?


GCC No 2 (single-stage, no bootstrap?) would have to be also x86_64
and have libraries and tools built for both arches (cross-compilation)
- x86_64 and powerpc.

This is two compilers.  Both have use x86_64 as the host and build
environment, and use the appropriate target as the target environment.
So, if I want a cross compiler which is x86_64 and cross-compiles for ppc is that one or two compilers (and chain tools) I need to build? I am confused now!


GCC No 3 would have to be powerpc only and have the libraries and
tools for that arch only.

Yes, I guess so, though I'm not sure what happened to the other target.
The two possible scenarios are

x86_64 (GCC1) -> x86_64 (GCC2) -> powerpc (GCC3) or
x86_64 (GCC1) -> x86_64 (GCC2) -> i586/i686 (GCC3)

So, I would need three compilers for the above, the second one (GCC2) being the most tricky as it needs to be able to use the power of the host system (x86_64) in order to build either powerpc or i586/i686 code - all in chroot-ed environment. Well, at least that is my take on it.


Is that correct? If so, what process needs to be followed for building
GCC No 3 - 3-stage bootstrap or a single-stage and bootstrap disabled?

For stage 3 build is x86_64 and host and target are both PPC or whatever.
I still don't understand? Should I enable bootstrap (and the 3-stage build) when I run configure for GCC3 (which would only need to compile code for the target architecture and nothing more, though it needs to have the toolchain built for that architecture as well)?


If the above is all correct, this seems to be a long-drawn process. Is
there any other route of achieving this (bearing in mind that I have
to preserve the target environment as 'pure' as possible from the
host)?

No, there are no shortcuts.  You may also want to look at
http://crosstool.org , they have some scripts which may or may not help.
Another gem, thank you. I will look at it in more detail as my head is turning into a mush right now and it is Friday!

MZ


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux