public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* 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

* Re: Cross compiler questions
  2010-03-19  9:29 Cross compiler questions Tom Hawkins
@ 2010-03-20 22:52 ` Michael Eager
  2020-02-27  9:34 ` Asha
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Eager @ 2010-03-20 22:52 UTC (permalink / raw)
  To: Tom Hawkins; +Cc: gcc-help

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.

Build --target=powerpc-eabi.

> 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?

This is to insure that target system characteristics specified in
the library's header files are used to build the final gcc.

> 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.

You'll probably find it easier to use an established build model
rather than try to create your own.  Build binutils, gcc, and newlib
for --target=powerpc-eabi.  If you never use any of the functionality
in the library, then there's really no cost.

You will need to create *crt* files which set up the C runtime
environment for your target if one of the variants in GCC or
Newlib/libgloss is not suitable.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

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

* Re: Cross compiler questions
  2010-03-19  9:29 Cross compiler questions Tom Hawkins
  2010-03-20 22:52 ` Michael Eager
@ 2020-02-27  9:34 ` Asha
  2020-02-28  1:01   ` Tadeus Prastowo
  1 sibling, 1 reply; 9+ messages in thread
From: Asha @ 2020-02-27  9:34 UTC (permalink / raw)
  To: gcc-help

Hi.....Tom Hawkins 

have you done with gcc cross compilation for powerpc. 
if yes,then please suggest me the steps from starting.

I want to cross compile gcc for powerpc7448 , After cross compilation want
to run one simple c/c++ program and get elf file,what are all the components
I required for cross compilation,
I am using the linux system.

I am newbie.

while searching in google ,I understood first I need to download and install
the gcc tool chain for powerpc,and need to install any tool like Eclipse.

After this what I need to do or how do I configure(please show me the
commands for  configuration).



--
Sent from: http://gcc.1065356.n8.nabble.com/gcc-Help-f629689.html

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

* Re: Cross compiler questions
  2020-02-27  9:34 ` Asha
@ 2020-02-28  1:01   ` Tadeus Prastowo
  2020-02-28 15:27     ` Asha
  0 siblings, 1 reply; 9+ messages in thread
From: Tadeus Prastowo @ 2020-02-28  1:01 UTC (permalink / raw)
  To: Asha; +Cc: gcc-help

On Thu, Feb 27, 2020 at 8:43 AM Asha <Ashusdiggi@gmail.com> wrote:
> I want to cross compile gcc for powerpc7448 , After cross compilation want
> to run one simple c/c++ program and get elf file,what are all the components
> I required for cross compilation,
> I am using the linux system.
>
> I am newbie.
>
> while searching in google ,I understood first I need to download and install
> the gcc tool chain for powerpc,and need to install any tool like Eclipse.
>
> After this what I need to do or how do I configure(please show me the
> commands for  configuration).

Have you checked https://crosstool-ng.github.io/ out?

-- 
Best regards,
Tadeus

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

* Re: Cross compiler questions
  2020-02-28  1:01   ` Tadeus Prastowo
@ 2020-02-28 15:27     ` Asha
  2020-03-02  2:57       ` Tadeus Prastowo
  0 siblings, 1 reply; 9+ messages in thread
From: Asha @ 2020-02-28 15:27 UTC (permalink / raw)
  To: gcc-help

Thank you for the replay,

After downloading and installing the crosstool-ng ,how do I proceed next.

how do I cross compile that one to powerpc7448.





--
Sent from: http://gcc.1065356.n8.nabble.com/gcc-Help-f629689.html

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

* Re: Cross compiler questions
  2020-02-28 15:27     ` Asha
@ 2020-03-02  2:57       ` Tadeus Prastowo
  0 siblings, 0 replies; 9+ messages in thread
From: Tadeus Prastowo @ 2020-03-02  2:57 UTC (permalink / raw)
  To: Asha; +Cc: gcc-help

On Fri, Feb 28, 2020 at 11:57 AM Asha <Ashusdiggi@gmail.com> wrote:
>
> Thank you for the replay,
>
> After downloading and installing the crosstool-ng ,how do I proceed next.
>
> how do I cross compile that one to powerpc7448.

You should ask the question in the mailing list of crosstool-ng.

-- 
Best regards,
Tadeus

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

* 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
  1 sibling, 0 replies; 9+ messages in thread
From: Kai Ruottu @ 2010-03-19 15:47 UTC (permalink / raw)
  To: gcc-help

On 19.3.2010 11:30, Kai Ruottu wrote:

> 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"

A typo, a colon instead of a semicolon in the previous step 3....

In order to check that the previous simple process, maybe told tens of 
times on maillists during
the last 15+ years, still works, I followed it strictly, after 
configuring, building and installing the
GNU binutils with the defaults, I configured, built and installed the 
current gcc-4.4.3 srcs with
the following (template) script :

../gcc-4.4.3/configure --build=i686-linux-gnu --host=i686-linux-gnu \
--target=ppc-eabi --enable-languages=c,c++ --disable-shared \
--with-gxx-include-dir=/usr/local/include/c++/4.4.3 \
--enable-version-specific-runtime-libs --with-newlib \
--with-pkgversion="by Kai Ruottu 2010q1"
#
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc

The '--disable-shared' may now be vain, earlier there was a bug which 
tried to use the shared
'libgcc_s.so.1' with some '*-elf' targets.  The default for the (IF 
being built) place for C++ headers
is now "target specific", not the earlier "common for all targets", the 
next option restores it. Also
as default the 'libstdc++' libs would be installed 
gcc-version-independently into the '$prefix/$target/lib',
therefore the next option. Building another GCC version later for the 
same target would overwrite
the gcc-version-specific 'libstdc++.a's.  The '--with-newlib' also 
belongs to this "generic build template"
and the last tells who to sue if something doesn't work....  Generally 
the '--enable-languages=c,c++'
could be enough as the only extra configure option.

There was absolutely no problems in the process, I used the last 
binutils-2.19.51 release for the
binutils....

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

* 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
  1 sibling, 0 replies; 9+ messages in thread
From: Kai Ruottu @ 2010-03-19 13:28 UTC (permalink / raw)
  To: gcc-help

Let's elaborate, simple things are the most hard to grok, the nature law 
called entropy states that
the world goes towards more disorder, to more complicated systems all 
the time :(

On 19.3.2010 11:30, Kai Ruottu wrote:
> 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!

"Bootstrap" in a native GCC builld is a 3-stage process, a cross GCC 
build doesn't use 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=.... "

The first build stage would be to build a native "boostrap GCC" from the 
same sources and
then use this "stage 1" GCC to build the cross GCC, this being the 
"stage 2"...

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

* 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

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:29 Cross compiler questions 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
2010-03-19  9:38 Kai Ruottu
2010-03-19 13:28 ` Kai Ruottu
2010-03-19 15:47 ` Kai Ruottu

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).