Trouble building cross-compiler i686-pc-linux-gnu => mipsel-elf

Ralf Jahr ralf.jahr@informatik.uni-augsburg.de
Wed Sep 10 13:48:00 GMT 2008


Hello!

Andrew Haley wrote:
> Ralf Jahr wrote:
> 
>> I try to build a cross-compiler for a mips-target. My goal is not to run
>> the code but to get an idea of how gcc performs optimizations as for
>> example modulo scheduling. The target I am actually working with is the
>> PISA architecture used by SimpleScalar. This is not supported but
>> similar to the mips4 architecture. So far...
>>
>> I used this tutorial [1] and GCC 4.3.2, binutils 2.18. Compiling the
>> binutils and gcc worked fine, it did not throw any errors. You can see
>> my log here: [2]
>>
>> [1] http://wiki.osdev.org/GCC_Cross-Compiler#Step_1_-_Bootstrap
>> [2] http://www.informatik.uni-augsburg.de/~jahrralf/gcc.php
>>
>> Well, i assumed that I would get a compiler which can build executables.
>> Unfortunately but this does not work; I get the following error message:
>>
>> /usr/cross-mips/lib/gcc/mipsel-elf/4.3.2/../../../../mipsel-elf/bin/ld:
>> crti.o: No such file: No such file or directory
>> collect2: ld returned 1 exit status
>>
>> More logging information can be seen here:
>>
>> http://www.informatik.uni-augsburg.de/~jahrralf/gcc.php#testing
>>
>> Should this normally have worked? Do you have any ideas how in can make
>> it working or what I did wrong?
> 
> crti.o is part of the C library.  You haven't installed a C library, so
> your programs won't link.
> 
> If you don't need to run your programs, you can simply use the -S option
> to gcc to produce source code.

OK, thanks for the inspiration. :-) I got newlibc to compile even 
without being able to generate executables. Then I saw that "make all" 
works with GCC although I thought it would not... Then some steps later 
I can now generate executables and use objdump on them. But I get a 
warning message:

./mipsel-elf-gcc -O3 hello.c -msoft-float -static
/usr/cross-mips/lib/gcc/mipsel-elf/4.3.2/../../../../mipsel-elf/bin/ld: 
warning: cannot find entry symbol _start; defaulting to 0000000000400050

I think I can live with this. But if I want to use printf I get another 
error:

./mipsel-elf-gcc -O3 hello.c -msoft-float -static

hello.c: In function 'main':
hello.c:16: warning: incompatible implicit declaration of built-in 
function 'printf'
/usr/cross-mips/lib/gcc/mipsel-elf/4.3.2/../../../../mipsel-elf/bin/ld: 
warning: cannot find entry symbol _start; defaulting to 0000000000400050
/tmp/ccqMFE2F.o: In function `main':
(.text+0xd4): undefined reference to `printf'
collect2: ld returned 1 exit status

Even adding the compiled libc.a does not help: [1]

[1] http://www.informatik.uni-augsburg.de/~jahrralf/liberrors.txt

Do you have any ideas how I can get rid of this error, too?

Thanks again!

Ralf



More information about the Gcc-help mailing list