public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help building basic cross-compiler
@ 2010-04-15 16:24 Manuel Coutinho
  2010-04-15 16:31 ` Francesco Turco
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Manuel Coutinho @ 2010-04-15 16:24 UTC (permalink / raw)
  To: gcc-help

Hi

I've been trying to build a cross-compiler for sparc but havent got much
luck :(

I've configure GCC with:

../gcc-4.4.3/configure --target=sparc-edisoft-rtems --with-gnu-as
--with-gnu-as --without-newlib --disable-bootstrap --verbose
--enable-threads --enable-languages="c"
--prefix=/rtems/mcoutinho/ri/gcc-without-newlib/prefix


The output of the compilation is the following:


/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/xgcc
-B/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/
-B/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/bin/
-B/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/lib/
-isystem
/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/include
-isystem
/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/sys-includ
e -g -O2 -msoft-float -O2
-I../../gcc-4.4.3/gcc/../newlib/libc/sys/rtems/include -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wcast-qual -Wold-style-definition  -isystem ./include
-g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc
-I. -I. -I../../.././gcc -I../../../../gcc-4.4.3/libgcc
-I../../../../gcc-4.4.3/libgcc/. -I../../../../gcc-4.4.3/libgcc/../gcc
-I../../../../gcc-4.4.3/libgcc/../include  -DHAVE_CC_TLS -o _bswapsi2.o -MT
_bswapsi2.o -MD -MP -MF _bswapsi2.dep -DL_bswapsi2 -c
../../../../gcc-4.4.3/libgcc/../gcc/libgcc2.c \
	  
/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/xgcc
-B/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/
-B/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/bin/
-B/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/lib/
-isystem
/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/include
-isystem
/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/sys-includ
e -g -O2 -msoft-float -O2
-I../../gcc-4.4.3/gcc/../newlib/libc/sys/rtems/include -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wcast-qual -Wold-style-definition  -isystem ./include
-g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc
-I. -I. -I../../.././gcc -I../../../../gcc-4.4.3/libgcc
-I../../../../gcc-4.4.3/libgcc/. -I../../../../gcc-4.4.3/libgcc/../gcc
-I../../../../gcc-4.4.3/libgcc/../include  -DHAVE_CC_TLS -o _bswapdi2.o -MT
_bswapdi2.o -MD -MP -MF _bswapdi2.dep -DL_bswapdi2 -c
../../../../gcc-4.4.3/libgcc/../gcc/libgcc2.c \
	  
/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/xgcc
-B/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/
-B/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/bin/
-B/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/lib/
-isystem
/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/include
-isystem
/rtems/mcoutinho/ri/gcc-without-newlib/prefix/sparc-edisoft-rtems/sys-includ
e -g -O2 -msoft-float -O2
-I../../gcc-4.4.3/gcc/../newlib/libc/sys/rtems/include -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wcast-qual -Wold-style-definition  -isystem ./include
-g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc
-I. -I. -I../../.././gcc -I../../../../gcc-4.4.3/libgcc
-I../../../../gcc-4.4.3/libgcc/. -I../../../../gcc-4.4.3/libgcc/../gcc
-I../../../../gcc-4.4.3/libgcc/../include  -DHAVE_CC_TLS -o _fixunssfsi.o
-MT _fixunssfsi.o -MD -MP -MF _fixunssfsi.dep -DL_fixunssfsi -c
../../../../gcc-4.4.3/libgcc/../gcc/libgcc2.c \
	  
In file included from
/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/include-fixed/sysli
mits.h:7,
                 from
/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/include-fixed/limit
s.h:11,
                 from ../../../../gcc-4.4.3/libgcc/../gcc/libgcc2.c:1693:
/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/./gcc/include-fixed/limit
s.h:122:61: error: no include path in which to search for limits.h
make[4]: *** [_fixunssfsi.o] Error 1
make[4]: Leaving directory
`/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/sparc-edisoft-rtems/soft
/libgcc'
make[3]: *** [multi-do] Error 1
make[3]: Leaving directory
`/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/sparc-edisoft-rtems/libg
cc'
make[2]: *** [all-multi] Error 2
make[2]: Leaving directory
`/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc/sparc-edisoft-rtems/libg
cc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory
`/rtems/mcoutinho/ri/gcc-without-newlib/tools/b-gcc'
make: *** [all] Error 2



So when the flag -DL_fixunssfsi is passed to compile libgcc2.c, the system
will try to find the limits.h file which is part of the newlib, but I don't
want newlib.

I've tried several different configurations and versions of GCC. As far as I
know, versions GCC-3.X work, but GCC-4.X don't :(.

My goal is to have the most basic cross-compiler possible, not dependent on
any system or library that will use it. I also would like not to have to
apply a patch to GCC in order to do this. 

Is this possible?

Tools versions:

gcc-4.4.3
binutils-2.20


Many thanks
Kind regards
Manuel Coutinho
Junior Programmer - Space

EDISOFT, S.A. 
Rua Quinta dos Medronheiros - Lazarim
Apartado 382 Monte de Caparica
2826-801 Caparica Portugal


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

* Re: Help building basic cross-compiler
  2010-04-15 16:24 Help building basic cross-compiler Manuel Coutinho
@ 2010-04-15 16:31 ` Francesco Turco
  2010-04-15 17:07 ` Michael Eager
  2010-04-15 18:32 ` Kai Ruottu
  2 siblings, 0 replies; 6+ messages in thread
From: Francesco Turco @ 2010-04-15 16:31 UTC (permalink / raw)
  To: Manuel Coutinho; +Cc: gcc-help

> I've configure GCC with:
> 
> ../gcc-4.4.3/configure --target=sparc-edisoft-rtems --with-gnu-as
> --with-gnu-as --without-newlib --disable-bootstrap --verbose
> --enable-threads --enable-languages="c"
> --prefix=/rtems/mcoutinho/ri/gcc-without-newlib/prefix

I'm far from being an expert, but I suggest you the following things:
- use a different triplet (the form should be sparc-vendor-os)
- also specify the --build and --host arguments
- drop one --with-gnu-as argument (you repeated it twice)
- drop --disable-bootstrap, as it is implicit when building a
  cross-compilator
- put --enable-languages=c instead of --enable-languages="c"
- specify the --with-sysroot argument
- make sure to build binutils before building gcc, and add the path to
  the binutils binaries to your PATH environment variable

For more informations, please have a look at:
- http://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html
- http://gcc.gnu.org/install/configure.html

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

* Re: Help building basic cross-compiler
  2010-04-15 16:24 Help building basic cross-compiler Manuel Coutinho
  2010-04-15 16:31 ` Francesco Turco
@ 2010-04-15 17:07 ` Michael Eager
  2010-04-16 12:02   ` Manuel Coutinho
  2010-04-15 18:32 ` Kai Ruottu
  2 siblings, 1 reply; 6+ messages in thread
From: Michael Eager @ 2010-04-15 17:07 UTC (permalink / raw)
  To: Manuel Coutinho; +Cc: gcc-help


> So when the flag -DL_fixunssfsi is passed to compile libgcc2.c, the system
> will try to find the limits.h file which is part of the newlib, but I don't
> want newlib.

You can use glibc, uclibc, or newlib.  Or create your own, naturally.

> 
> I've tried several different configurations and versions of GCC. As far as I
> know, versions GCC-3.X work, but GCC-4.X don't :(.
> 
> My goal is to have the most basic cross-compiler possible, not dependent on
> any system or library that will use it. I also would like not to have to
> apply a patch to GCC in order to do this. 

The short answer is no.  GCC needs to build libgcc for the target environment,
so you need to select which environment it will use.  This is why the routine
is looking for limits.h (and likely other include files).

It might be possible to look through libgcc2.c and see if there are any
build options which might avoid most of the uses of headers supplied by
one of the libraries.  But you are not likely to find any standard
configure triplet which does this.

Why do you want to build a compiler without specifying the library?


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

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

* Re: Help building basic cross-compiler
  2010-04-15 16:24 Help building basic cross-compiler Manuel Coutinho
  2010-04-15 16:31 ` Francesco Turco
  2010-04-15 17:07 ` Michael Eager
@ 2010-04-15 18:32 ` Kai Ruottu
  2010-04-16  2:30   ` Kai Ruottu
  2 siblings, 1 reply; 6+ messages in thread
From: Kai Ruottu @ 2010-04-15 18:32 UTC (permalink / raw)
  To: gcc-help

15.4.2010 18:41, Manuel Coutinho kirjoitti:
> Hi
>
> I've been trying to build a cross-compiler for sparc but havent got much
> luck :(
>
> I've configure GCC with:
>
> ./gcc-4.4.3/configure --target=sparc-edisoft-rtems --with-gnu-as
> --with-gnu-as --without-newlib

The RTEMS RTOS uses newlib AFAIK...

> So when the flag -DL_fixunssfsi is passed to compile libgcc2.c, the system
> will try to find the limits.h file which is part of the newlib, but I don't
> want newlib.

but you don't want it although RTEMS needs it... Must grok a while this
logic...

> My goal is to have the most basic cross-compiler possible, not dependent on
> any system or library that will use it.

So please make a choice for what you want, a GCC for RTEMS or a GCC for
something else than RTEMS...

> Is this possible?

If you know what you want, people can tell if it is possible...

One guess would be that you would like to have a GCC for the common
'sparc-elf', ie. the toolchain should produce ELF-format objects.

Producing newlib binaries is totally voluntary! It maybe be the
assumption, the default action or whatever, but it has never been
obligatory!  Using a "fake" '--with-newlib' should enable producing
libgcc WITHOUT any headers, the libgcc configure knowing what newlib
is so why investigate anything via the headers?

People seemingly are full of the MS-propaganda ("If I need a PC, I must
also get Windows"), so the clause "If I need a base GCC, I must build
newlib", sounds totally sane for them...  Who on earth delivers this
false propaganda into the GCC world?

> Tools versions:
>
> gcc-4.4.3

A bare GCC can be produced without anything, headers or libs, provided
for the target system. Simply :

make all-gcc

"Make everything which belongs to GCC!"  A bare 'make' uses the
assumptions for "an ordinary builder"...

> binutils-2.20

Just as binutils.

It takes a minute to start a GCC build for 'sparc-elf' with 'make 
all-gcc', but before it to make sure that there are no headers and no
libs for the target at all. I really have some GCCs for this target
installed from the past years, with a built common newlib - how else
I could test simple 'sparc-elf' executables in GDB/Insight?  A Finn
doesn't believe (a propaganda) until a Finn sees, that's a fact!

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

* Re: Help building basic cross-compiler
  2010-04-15 18:32 ` Kai Ruottu
@ 2010-04-16  2:30   ` Kai Ruottu
  0 siblings, 0 replies; 6+ messages in thread
From: Kai Ruottu @ 2010-04-16  2:30 UTC (permalink / raw)
  To: gcc-help

15.4.2010 20:07, Kai Ruottu kirjoitti:

> A bare GCC can be produced without anything, headers or libs, provided
> for the target system. Simply :
>
> make all-gcc
>
> "Make everything which belongs to GCC!" A bare 'make' uses the
> assumptions for "an ordinary builder"...

A man came into a PC-shop and wanted to buy a bare PC. The shopkeeper
asked if the customer really didn't want an opsys like Windows to the
PC. The customer said that he really didn't want anything like that!
The next day the customer came back with the PC and said that it didn't
work! The problem was that it didn't show the same GUI as the PC he had
seen in the shop and so demanded a "working PC" for the price he had
paid...

Sometimes it sounds like that many GCC-builders are just like this
customer, they want a "working" GCC but when they get one, they don't
understand it being fully "working" :(

Quite many maybe expect GCC being capable at least to compile and link a
"Hello World" in C, sometimes in C++, but maybe don't understand what
that means: a working C library and additionally a C++ class library
with C++... They want a "working" GCC, but they don't want a C library,
neither a C++ library, the GCC should "work" without them!

The PC shop keeper decided to sell only "working" PCs because the
customers were idiots... The GCC developers decided to let the GCC
build to produce "working" GCCs because the GCC builders were idiots...

Because of these idiots those who know must suffer, or then not...
PCs can still be bought without an opsys, GCCs can still be built
without having a C library....

Is the previous true or not true, everyone can think oneself! Basically
it could be expected people to know what to do with a PC without an
opsys or with a GCC without any C library, without any C++ library, 
without a libgcc,..., but who really knows what the people really are
knowing about these basic things :(

Ok, in the gcc-4.4.3 for 'sparc-elf' case there was absolutely NO
problems with the 'make all-gcc', neither in 'make all-target-libgcc'.
No target C headers, no target C libraries! The build-script was :

------------- clip -----------------
../gcc-4.4.3/configure --build=i686-linux-gnu --host=i686-linux-gnu \
--target=sparc-elf --enable-languages=c,c++ --disable-shared \
--with-gxx-include-dir=/usr/local/include/c++/4.4.3 \
--enable-version-specific-runtime-libs --with-newlib
#
make all-gcc
make all-target-libgcc
------------- clip -----------------

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

* RE: Help building basic cross-compiler
  2010-04-15 17:07 ` Michael Eager
@ 2010-04-16 12:02   ` Manuel Coutinho
  0 siblings, 0 replies; 6+ messages in thread
From: Manuel Coutinho @ 2010-04-16 12:02 UTC (permalink / raw)
  To: 'Michael Eager'; +Cc: gcc-help

Thank you very much for your answer. Would like thank also Franscesco for
his answer :)

Looks like I have to make my own library.

I would like to make it independent because I am validating an RTOS (RTEMS)
and has to be independent of any outside libraries, 
that is, newlib or glibc or uclib cannot be inside the final executable.
Also, the GCC headers should also not be inside the final executable.
Even though we have already done this (checked by readelf of the
executable), a natural question arises: why should we compile newlib if we
are not using it?

So, this is more of a quest to find an elegant solution than a practical
issue.

I think that the GCC versions 3.X allowed to do this, but there is a
floating point bug in GCC (for SPARC) for which there is a patch only for
the version GCC-4.3.3. That's why we wanted to use this version (or higher).

Currently, we are just trying to find which versions we can use and what we
can do to make GCC (and RTEMS) independent of outside libraries.

Thanks again
Manuel Coutinho
Junior Programmer - Space

EDISOFT, S.A. 
Rua Quinta dos Medronheiros - Lazarim 
Apartado 382 Monte de Caparica 
2826-801 Caparica Portugal

 

> -----Original Message-----
> From: Michael Eager [mailto:eager@eagerm.com] 
> Sent: Thursday, April 15, 2010 5:31 PM
> To: Manuel Coutinho
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: Help building basic cross-compiler
> 
> 
> > So when the flag -DL_fixunssfsi is passed to compile libgcc2.c, the 
> > system will try to find the limits.h file which is part of 
> the newlib, 
> > but I don't want newlib.
> 
> You can use glibc, uclibc, or newlib.  Or create your own, naturally.
> 
> > 
> > I've tried several different configurations and versions of GCC. As 
> > far as I know, versions GCC-3.X work, but GCC-4.X don't :(.
> > 
> > My goal is to have the most basic cross-compiler possible, not 
> > dependent on any system or library that will use it. I also 
> would like 
> > not to have to apply a patch to GCC in order to do this.
> 
> The short answer is no.  GCC needs to build libgcc for the 
> target environment, so you need to select which environment 
> it will use.  This is why the routine is looking for limits.h 
> (and likely other include files).
> 
> It might be possible to look through libgcc2.c and see if 
> there are any build options which might avoid most of the 
> uses of headers supplied by one of the libraries.  But you 
> are not likely to find any standard configure triplet which does this.
> 
> Why do you want to build a compiler without specifying the library?
> 
> 
> -- 
> Michael Eager	 eager@eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306  650-325-8077
> 

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

end of thread, other threads:[~2010-04-16  8:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15 16:24 Help building basic cross-compiler Manuel Coutinho
2010-04-15 16:31 ` Francesco Turco
2010-04-15 17:07 ` Michael Eager
2010-04-16 12:02   ` Manuel Coutinho
2010-04-15 18:32 ` Kai Ruottu
2010-04-16  2:30   ` 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).