MacOS – How to compile gcc-4.0 on Mountain Lion

gccmacosopen source

So far I've successfully launched the configure, but when I type make, I get the following error, after some time (there's a lot which compile successfully):

ld: unknown/unsupported architecture name for: -arch i686
/usr/bin/libtool: internal link edit command failed
make[2]: *** [libgcc_s.dylib] Error 1
make[1]: *** [libgcc.a] Error 2
make: *** [all-gcc] Error 2

Is there a way to tell gcc not to compile itself for the i686 architecture?

Here's my uname -a if it can help:

Darwin Frizlabs-Computer.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

PS: I know gcc-4.0 is ancient, but I do need it.

Best Answer

Someone on serverfault answered the same question. So here's the way to compile gcc-4.0 on OS X Mountain Lion (copied from serverfault):

First get the old 4.0 package that was included with XCode 3.1 from Apple's Open Source page

Download the gcc-5493 package and build using:

mkdir darwin
cd darwin
../configure --prefix=/tmp/testplace --enable-languages=objc,c++
make bootstrap
make install