cross GCC building error

Kai Ruottu
Wed Sep 20 20:01:00 GMT 2006

manjunatha kirjoitti:
> Hi    I am  geeting the  following  error  on building cross compiler 
> for MIPS,
 You are NOT getting the error when "on building cross compiler", but when
trying to use the already built compiler to produce the 'libiberty' 
library for the
target !  The GCC build tries to do this AFTER the compiler is made...

If you want to build ONLY GCC, you write 'make all-gcc' as the 'make' 

If you want to install ONLY GCC, you write 'make install-gcc' as the 
'make install'
> My  gcc config is
> # ./configure  -target-mips-elf --prefix=/usr/local 
> --enable-language=c --with-gnu-as --with-gnu-ad
 The 'ad' probably was a typo...

> On  executing command  'make' . Iam  getting  the  error.

> checking whether the C compiler ( 
> /root/Project-Genesis1-uClibc-scratch/gcc-src/gcc-test/gcc-3.3.2/gcc/xgcc 
> -B/root/Project-Genesis1-uClibc-scratch/gcc-src/gcc-test/gcc-3.3.2/gcc/ 
> -B/usr/local/mips-elf/bin/ -B/usr/local/mips-elf/lib/ -isystem 
> /usr/local/mips-elf/include -O2 -g -O2 ) works... no
> configure: error: installation or configuration problem: C compiler 
> cannot create executables.
> make: *** [configure-target-libiberty] Error 1

 In the GCC case the binaries: 'gcc', 'cc1', 'collect2' etc., the 
'libgcc*.a' helper libraries plus
some GCC's own headers, are what would be called as "C compiler".  The 
built C compiler can
produce assembly source from the high-level C source but nothing much 
more, producing
executables happens with the linker, 'ld', after 'as' has converted the 
assembly into an object.
And of course the standard C library is required to provide the 
startups, 'crt*.o', the standard
'libc', the standard C headers etc.   So what I wrote earlier :

  "The 'mips-elf' targeted libraries and headers then SHOULD be in these 
two directories...
In your case some uClibc made for the 'mips' architecture, at least the 

 The standard C headers for the target are required when compiling the 

 In order to see what the 'libc' has in it, the libiberty configure does 
some link tests
with some simple programs. And in that comes the error you got!

 So just do a "make install-gcc", then try to "compile" (and link) a 
"Hello World" with the
uClibc you have for MIPS... If you haven't that yet, then use your 
installed GCC to build
it first!  After installing and everything expected to be OK, just try 
that "Hello World"
and see what on earth is the problem...  Usually the problem is that 
there is no C library
and therefore producing executables by linking against it impossible. 
What doesn't exist
must be created first!

> It  seems  to problem while building libiberty.

Yes!  But it would be better you to do your homework: install the new 
GCC and then
try it to compile&link some simple apps... If these are succeeding but 
the configure
still fails, then it is the time to dig into those logfiles you put here...

More information about the Gcc-help mailing list