Cross-compiler for arm-elf hosting on Solaris

Kai Ruottu
Fri Nov 9 02:27:00 GMT 2001 wrote:
> I'm trying to build a cross-compiler for arm-elf hosted on
> Solaris/SPARC with GCC 3.0.x. Has anyone else done this? I've looked
> at various FAQs and mailing list archives but all seem targeted at
> 2.95.x.

 What about reading your GCC-manual, "Installation / Cross-Compiler" ?
Of course you must have the full "Using and Porting the GNU Compiler
Collection (GCC)", not only the "Using the GNU...".

 The GCC-sources include the '.texi' sources for the manual and with
'makeinfo', 'TeX', 'texi2html', 'makertf', 'Ghostscript' etc. you can
build a manual in a format suitable to you...  Or you can perhaps
download a prebuilt GCC-manual for gcc-3.0.2 somewhere...

 Some people may have the Adobe tools and using them it is somehow
possible to create a nice PDF-manual for GCC. I assume the :

  TeX --> dvips --> ps2pdf

method creating a not-so-beautiful PDF-manual. If one looks at the
GNUPro PDF-docs from RedHat with "Document Properties", they seem
to be 'created' with FrameMaker+SGML and 'produced' by Acrobat Distiller... 

> Building binutils as part of the GCC build process is easy and I can
> get as, ld, ranlib, and ar built but GCC seems to want ARM-specific
> headers (--without-headers is equivalent to --with-headers=no which
> tries to install the headers in the directory 'no'):

 The Cross-GCC instructions in the GCC-manual ask the GCC-builder to
preinstall the target headers and libraries before starting to build
GCC. In the 'system' target cases (Linux-x-Solaris2 etc.) both the
headers and libraries are prebuilt and available in the target system
or on its install media. But the targets using newlib normally don't
have the libs easily available as prebuilt. The 'arm-elf' belongs to
this group...

 Anyway the 'target headers' coming with newlib are easily available in
the 'newlib-1.9.0/newlib/libc/include' in the current newlib sources...
And the install place is the well-known (at least this should be...)
'$prefix/$target/include' --- this is the place where also the newlib-
install will put them.  And only the target headers will be needed for
building GCC and all the needed 'libgcc.a's.

>   $ ../configure --with-gnu-as --with-gnu-ld --with-newlib \
>   --target=arm-elf --enable-languages="c,c++"

 The target headers being preinstalled, and using the '--with-newlib'
enables one to build also the extra 'libiberty' and 'libstdc++' libs
without any problems -- newlib is a well-known entity and the GCC-build
knows it, so no sanity-checks will be needed. The Objective-C and its
'libobjc.a's are exceptions and the famous "C compiler cannot create
executables" comes there (no target libs and startups available for
linking yet...)

 After doing your '../configure', having copied the target headers and
writing 'make', and waiting a hour or so, you should have your Cross-GCC
ready with all the extra libs for C and C++. Then just write 'make install',
build newlib using the installed GCC (please read the build instructions)
and finally build GDB or Insight with the ARM-simulator (simulating a ARM
Demon or Angel? monitor based system).

>   gmake[2]: Entering directory `/opt/build/gcc-3.0.2/objdir/gcc'
>   stage1/xgcc -Bstage1/ -B/opt/TWWfsw/gcc302-arm/arm-elf/bin/ -c

 What was the 'make' command?  Using the 'stage1' hints you trying a
native-GCC, not a cross-GCC...

>   -DCROSS_COMPILE -DIN_GCC  -DSVR4  -g -O2 -W -Wall -Wwrite-strings
>   -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
>   -Wno-long-long  -DHAVE_CONFIG_H -DGENERATOR_FILE    -I. -I.
>   -I../../gcc -I../../gcc/. -I../../gcc/config -I../../gcc/../include
>   ../../gcc/gengenrtl.c
>   In file included from ../../gcc/gengenrtl.c:23:
>   ../../gcc/system.h:50:19: stdio.h: No such file or directory

 Trying to compile 'gengenrtl.c' with the 'arm-elf' target GCC is
something really insane...

 It looks like that you already have some kind of 'arm-elf'-target GCC
in '/opt/build/gcc-3.0.2/objdir/gcc/stage1'. A Cross-GCC will be built
only once, using the best native-GCC for this purpose, while the native
GCC will perhaps be built first with the non-GCC native 'cc' as the
'bootstrap'-compiler, then with the just built 'stage1' native GCC and
perhaps once more with the GCC-built 'stage2' native GCC...

 Please build your cross-GCC only once with your selected 'production'
GCC... It doesn't need to be gcc-3.0.2, or one could even suggest it
NOT being gcc-3.0.2... I still use egcs-1.1.2 for many reasons with
the x86-hosts...

Cheers, Kai

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list