public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Cross compiler questions
@ 2010-03-19  9:38 Kai Ruottu
  2010-03-19 13:28 ` Kai Ruottu
  2010-03-19 15:47 ` Kai Ruottu
  0 siblings, 2 replies; 9+ messages in thread
From: Kai Ruottu @ 2010-03-19  9:38 UTC (permalink / raw)
  To: gcc-help

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!

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Cross compiler questions
@ 2010-03-19  9:29 Tom Hawkins
  2010-03-20 22:52 ` Michael Eager
  2020-02-27  9:34 ` Asha
  0 siblings, 2 replies; 9+ messages in thread
From: Tom Hawkins @ 2010-03-19  9:29 UTC (permalink / raw)
  To: gcc-help

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?

And second, is it possible to build a GCC cross compiler without a
standard library?  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.

Thanks!

-Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-02  2:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-19  9:38 Cross compiler questions Kai Ruottu
2010-03-19 13:28 ` Kai Ruottu
2010-03-19 15:47 ` Kai Ruottu
  -- strict thread matches above, loose matches on Subject: below --
2010-03-19  9:29 Tom Hawkins
2010-03-20 22:52 ` Michael Eager
2020-02-27  9:34 ` Asha
2020-02-28  1:01   ` Tadeus Prastowo
2020-02-28 15:27     ` Asha
2020-03-02  2:57       ` Tadeus Prastowo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).