How to compile gcc-4.0 on Mountain Lion

2

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.

Frizlab

Posted 2012-11-03T05:07:16.213

Reputation: 123

Answers

1

GCC is included with XCode but if you really just need GCC, I also found this project on GitHub for the OSX GCC installer.

https://github.com/kennethreitz/osx-gcc-installer

The osx-gcc-installer allows you to install the essential compilers from either pre-built binary packages or helps you create your own installer.

For Lion and Mountain Lion users, Apple now provides an official Command Line Tools for Xcode package that you can install without needing to install Xcode itself! You can download it from Apple's developer site. If you still need gcc-4.2, and you use Homebrew, you can install it using the apple-gcc42 package from homebrew/dupes.

EDIT:

Okay, go get the older 4.0 package that was included with XCode 3.1 from Apples Open Source page

Download the gcc-5493 package and I tested compiling using instructions from the README.Apple

BUILDING, THE APPLE WAY didn't work for me but the BUILDING, THE FSF WAY worked with modification...

To build things the FSF WAY way i need to add the --enable-languages=objc,c++,obj-c++ to restrict languages. Something was causing it to error out and I don't have time to figure out which one. But using below successfully compiled.

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

Also make sure you have XCode and Command line tools installed

Using built-in specs.
Target: i686-apple-darwin12.2.0
Configured with: ../configure --prefix=/tmp/testplace --enable-languages=objc,c++,obj-c++
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5493)

Brandon

Posted 2012-11-03T05:07:16.213

Reputation: 551

Actually I'm search for gcc-4.0, not 4.2. gcc-4.2 does not work for my needs. – Frizlab – 2012-11-03T06:31:54.220