Re: Cross compiler questions

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

 



On 19.3.2010 1:30, Tom Hawkins wrote:
Hi,

I'm attempting to build a GCC cross compiler to target embedded
powerpc targets with no OS.  I have a couple questions.  Sorry if
these have been answered before.

First, why does GCC needed to be built twice -- once before, and once
after building the standard library -- even if GCC is already
installed on the host platform?

Please read the "Prerequisites" in "Install"

http://gcc.gnu.org/install/prerequisites.html

and you will see that what you are claiming is pure bullshit! A cross compiler as default requires only one build stage, if you see something else claimed elsewhere, please don't believe it!

If one wants Java, then  a 2-stage build process is obligatory :

"If the cross compiler is to be built with support for the Java programming language and the ability to compile .java source files is desired, the installed native compiler used to build the cross compiler needs to be the same GCC version as the cross compiler. In addition the
 cross compiler needs to be configured with --with-ecj-jar=.... "

> And second, is it possible to build a GCC cross compiler without a standard library?

Of course, the 'make all-gcc' should build only in 'gcc'... But maybe one wants the base soft-float routines etc. and so making also the 'libgcc*.a's comes in question. This was discussed on this list some time ago but generally 'make all-target-libgcc' should do that.
   My applications are very low level.  Basically my C
code just reads and writes hardware registers; it has no use for
anything in stdlib.h, stdio.h, math.h, etc.  I'm having a hard time
finding the magic combinations of binutils, gcc, and newlib that can
build without errors.  I may have better luck if I can remove newlib
and the second GCC build from the equation.

Please inform us from where you have read all the bullshit you refer like the "GCC needed to be built twice" ! There is that bolshevik-group around the 'crosstool*' with their weird "everything from scratch and every build using the same rules" attitude, but that should be limited only to those "Linux from Scratch" projects and have absolutely nothing to do with building "normal" crosscompilers like those for existing systems (Linux distros, Solarises, AIXes, Cygwin, MinGW,...) which already have their prebuilt and tested custom C libraries. Neither with producing crosscompilers for embedded systems, those which don't have any "native" GCCs for them at all... The "crosstool*"-catered targets are not yet existing self- made Linuces and the bolshevik-group doesn't like to use any "bootstrap" components in their builds, ie build the toolchains "normally", cross GCCs for existing systems with some existing (bootstrap) C library (from some "similar" target system, a Linux distro for instance).

Ok, in your case the build process would be :

1. build and install binutils, "make ; make install"
2. build and install ONLY GCC, "make all-gcc ; make install-gcc"
3. possibly build and install 'libgcc', "make all-target-libgcc : make install-target-libgcc"

The process for building GCC with newlib would be :

1. build and install binutils, "make ; make install"
2. copy or symlink the 'newlib' and 'libgloss' subdirs from the newlib sources into the main
    GCC source directory
3. add the '--with-newlib' into the GCC configure options
4. build and install GCC AND newlib, "make ; make install"

ONLY one build stage as you can see!

[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