help regarding native compiler building

Kai Ruottu kai.ruottu@wippies.com
Thu Jan 31 11:54:00 GMT 2013


30.1.2013 17:32, Tango Nair kirjoitti:

> i tried the same way. as follows
>
> ./configure --target=mips-unknown-linux --host=mips-unknown-linux --build=i686-pc-linux  --enable-languages=c
>
> and exported the cross tool chain in the PATH
>
> i could able to create the native compiler,  but it's not working on my target for simple functions such as below
>
> int foo()
> {
> return 0;
> }
>
> it's giving "???bad rtl" as error.
>

Is it working in any way?  What will the simple tests like :
        gcc -v
        gcc --help
say?

What I have seen is that people usually don't know what a cross 
toolchain means,
or what it should do :-(   For instance what is the system it creates 
apps for, is it
some virtual "generic system". This is the case when one produces 
everything in
the cross toolchain oneself : binutils, GCC and even the C library for 
the target.
But the expectation is that the C library (runtimes) installed on the 
target is
identical with the one the cross toolchain has as its target C library. 
If one builds
the target C library oneself, it means that the target system didn't 
have it yet and
this was the reason to build it!  Otherwise the question is "Why on 
earth it was
rebuilt for the cross toolchain if the target system had it in the very 
beginning?"

So what else you did copy onto the target system besides the GCC 
binaries? What
about the C library headers, normally in '/usr/include', the libs in 
'/lib' and '/usr/lib'
in Linux?  Were these the same used in the cross toolchain? If so, they 
were once
copied onto the cross host to serve as the 'mips-unknown-linux' target C 
library
there.  Or were copied from the cross toolchain onto the 
'mips-unknown-linux'
target system...

In cases where the cross toolchain creates executables for "something 
else" than
the real target system, one should know what one does.  For instance when I
myself create executables for a CentOS 5.8 Linux/i386 system, I expect 
them to
work OK on my CentOS 6.3/x86_64 and Fedora 14/i686 systems which have
newer glibcs on them (as runtimes).  And of course if I cross compile a 
GCC for
the CentOS 5.8 host on my CentOS 6.3 system, I expect it working 
perfectly when
copied onto the CentOS 5.8 system.

Maybe simple "Hello World" apps have worked OK this far when crosscompiled
but GCC is a much more complicated application...



More information about the Gcc-help mailing list