views:

83

answers:

1

I am following the instructions here for cross-compiling GCC. I am on a mac. When I run this command from the gcc source folder: ./configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --without-headers --enable-languages=c,ada,c++,fortran,java,objc,obj-c++,treelang I get this error: configure: error: GMP 4.1 and MPFR 2.2.1 or newer versions required by fortran. When I change the command to this (I couln't compile GMP): ./configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --without-headers --enable-languages=c,ada,c++,java,objc,obj-c++,treelang I get this error:

The following requested languages could not be built: ada
Recognised languages are: c,ada,c++,fortran,java,objc,obj-c++,treelang

which doesn't make sense to me because it says ada is recognized. All other configurations of the enable-languages settings (and when the setting isn't changed and the default is used) give me this error:

/usr/local/cross/i586-elf/bin/ranlib ./libgcov.a
_error_not_here_yet - havent even thought about it - it may even work
make[1]: _error_not_here_yet: Command not found
make[1]: *** [treelang.all.cross] Error 127
make: *** [all-gcc] Error 2

How can I cross compile GCC?

+2  A: 

Are you running configure from the gcc source tree? If so: don't do that. Follow the instructions (verbatim) in the page you linked to.

Look carefully and you'll notice that they're running the configure command from outside the gcc source tree.

If your platform is supported by it, the crosstool script (also linked from the bottom of your instructions page) is very helpful.

Edit: As potatoswatter points out in a comment, your installation is probably hosed at this point. Remove the whole tree and start from scratch. (It sounds like it will take too long, and you'll want to take a short cut, but it will be faster in the end if you just start from scratch now.)

bstpierre
Furthermore, running `configure` in there can corrupt an installation. At least, after I made that mistake I couldn't build it until I nuked and downloaded it all over again.
Potatoswatter
crosstool-ng is an actively maintained rewrite of crosstoolhttp://ymorin.is-a-geek.org/projects/crosstool
Hasturkun
@Hasturkun - thanks for the link, I'll have to check that out next time I'm in need.
bstpierre