Building a cross-compiler

Andrew Haley aph@redhat.com
Tue Jan 29 19:04:00 GMT 2008


Wenton L. Davis wrote:
> I am finally going to admit defeat and come ask for help on this.  I am 
> trying to build a cross-compiler to run on an x86 machine for several 
> targets: ARM, MIPS, AVR, and m681x.  I would like a single compiler to 
> handle those 4 architectures in addition to the x86, eventually.  
> However, for now, I am just trying to get the individual targets able to 
> compile.
> 
> I can get the binutils to compile/install/run just fine.  The compiler 
> build, however, is not cooperating, and I am almost certain I am 
> overlooking something remarkably simple, but I just don't see it.  I 
> have my source tree installed in /mnt/tmp/gcc-4.1.2 and I am building in 
> /mnt/tmp/objdir.  (I found one recommendation to always build in a 
> seperate directory.)  I configure it with the following (as run from in 
> objdir):
> 
> ../gcc-4.1.2/configure --prefix=/mnt/tmp --program-prefix=mips-elf- \
>  --target=mips-elf --enable-threads=posix --enable-shared \
>  --enable-languages=c --disable-checking --with-gnu-ld --verbose
> 
> 
> This should, as I understand it, build the MIPS's compiler and after 
> running "make install"put it in the /mnt/tmp/bin directory, prefixing 
> each executable with "mips-elf-"  right?
> 
> After configure runs, I just type 'make' to build the compiler.
> 
> Everything goes OK (now that I figured out the --enable-threads=posix 
> thing), until I get to this  (I apologize about the formatting, but I 
> wanted to send exactly what I see):
>
>                 from ../../gcc-4.1.2/gcc/unwind-dw2.c:42:
> ../../gcc-4.1.2/gcc/gthr-posix.h:43:21: error: pthread.h: No such file 
> or directory

OK, take a step backawards.  You're building a cross-compiler for MIPS, but
what operating system / C library do you intend to target?  gcc doesn't contain
a C library, and you are going to need one.  gcc also needs to know what OS
your target is going to run.

You can use newlib as a minimal target C library, but I'm not sure if that's
what you want.

Andrew.



More information about the Gcc-help mailing list