problems compiling x86 to sparc

Kai Ruottu
Tue Jan 22 07:59:00 GMT 2002

Josh Thompson wrote:
> Hi, I am new to this list and to cross compiling.

 Then using methods aimed for novices would be suggested...

> I am having trouble compiling
> gcc 3.0.3 for a sun IPC box.  I have binutils-2.11.2 and glibc-2.2.4.  I am
> following the FAQ at, using
> prefix=/usr/local/sparc, target=sparc-linux-gnu, host=i686-pc-linux-gnu.
> binutils seems to compile and install successfully, when I try to compile gcc, I
> get the following error (I wasn't sure how much to attach, I can attach more if
> needed):

 Much less attached stuff would have been enough...

> /usr/local/src/sparc/build-gcc/gcc/xgcc -B/usr/local/src/sparc/build-gcc/gcc/
> -B/usr/local/sparc/sparc-linux-gnu/bin/
> -B/usr/local/sparc/sparc-linux-gnu/lib/
> -isystem /usr/local/sparc/sparc-linux-gnu/include

 When building a native GCC, the binutils, libs and headers for it are already there
during the build. Also the three last lines here assume this stuff for the target
already being in '/usr/local/sparc/sparc-linux-gnu/'. You get it when downloading a
prebuilt glibc for 'sparc-linux' host/target somewhere (RedHat, SuSE, Debian,...).

 Or perhaps you even have the target system available for copying the stuff from it.
In any case you must know what the target is and what is possible to run there...
If the target system would be running Solaris2.4 and your cross-tools would produce
binaries for Solaris2.8, it would be quite unprobable that the produced binaries
would run ok on the target system...

 If your target is Sun IPC, you probably have some specific Linux/Sparc distribution
there and perhaps the 'generic sparc-linux-gnu' binaries linked against glibc-2.2.4,
which you are trying to build now, will not run there at all... The prerequisite is
that you have at least the glibc-2.2.4 there (a newer one is expected to be backwards-

> -f && ln -s
> /usr/local/sparc/sparc-linux-gnu/bin/ld: cannot open crti.o: No such file or
> directory

 The Linux/Sparc C-library (glibc) includes this startup, so just install it with
all the other target stuff, following the instructions in the GCC-manual (not only
the instructions in some weird FAQ) :

-------------------------- clip --------------------------------------------------
Building and Installing a Cross-Compiler


Since GNU CC generates assembler code, you probably need a cross-assembler that GNU
CC can run, in order to produce object files.  If you want to link on other than the
target machine, you need a cross-linker as well.  You also need header files and
libraries suitable for the target machine that you can install on the host machine.
-------------------------- clip --------------------------------------------------

 If you don't follow the instructions for novices, be sure to meet these 'Catch-22'
problems about needing the C-library in the GCC-build and needing GCC to build the

 Linking the shared '' requires the C-library already being there, just
as it would exist in the native build.  The glibc-version doesn't need to be the
one you are going to use when using the toolchain, you can always update it later.
But having something working during the GCC-build is the easy way... And the run-
time libs installed in the target tell how up-to-date binaries you can run there.

 Ok, an experienced Cross-GCC builder can edit the requirement for ''
away, pre-install GCC, build glibc from scratch, continue the GCC-build etc., but
using the available target stuff and pretending that there aren't any sources for
it is always the 'piece of cake'-method for a novice... And for a lazy master having
a speedy connection to the net and being in a hurry (it takes quite a lot time to
build glibc even with the modern 1 G+ machines...)

Cheers, Kai

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

More information about the crossgcc mailing list