PREV UP next Using and Porting GNU CC

4.3.6: Actually Building the Cross-Compiler

Now you can proceed just as for compiling a single-machine compiler through the step of building stage 1. If you have not provided some sort of `libgcc1.a', then compilation will give up at the point where it needs that file, printing a suitable error message. If you do provide `libgcc1.a', then building the compiler will automatically compile and link a test program called `cross-test'; if you get errors in the linking, it means that not all of the necessary routines in `libgcc1.a' are available.

If you are making a cross-compiler for an embedded system, and there is no `stdio.h' header for it, then the compilation of `enquire' will probably fail. The job of `enquire' is to run on the target machine and figure out by experiment the nature of its floating point representation. `enquire' records its findings in the header file `float.h'. If you can't produce this file by running `enquire' on the target machine, then you will need to come up with a suitable `float.h' in some other way (or else, avoid using it in your programs).

Do not try to build stage 2 for a cross-compiler. It doesn't work to rebuild GNU CC as a cross-compiler using the cross-compiler, because that would produce a program that runs on the target machine, not on the host. For example, if you compile a 386-to-68030 cross-compiler with itself, the result will not be right either for the 386 (because it was compiled into 68030 code) or for the 68030 (because it was configured for a 386 as the host). If you want to compile GNU CC into 68030 code, whether you compile it on a 68030 or with a cross-compiler on a 386, you must specify a 68030 as the host when you configure it.

To install the cross-compiler, use `make install', as usual.