现在的位置: 首页 > 综合 > 正文

Install GCC-4.2.1 (Apple build 5666.3) with Xcode 4.2 Caius Durling – 2011-10-30 17:36:48 As of Xcode 4.2 Apple have stopped bundling GCC with it, sh

2012年04月07日 ⁄ 综合 ⁄ 共 1204字 ⁄ 字号 评论关闭

Install GCC-4.2.1 (Apple build 5666.3) with Xcode 4.2

Caius Durling 2011-10-30 17:36:48

As of Xcode 4.2 Apple have stopped bundling GCC with it, shipping only the (mostly) compatible llvm-gcc binary instead. The suggested fix is to install GCC using the osx-gcc-installer project. However, I wanted to build and install it from source, which apple provides at http://opensource.apple.com/.

You should already have installed Xcode 4.2 from the app store, then basically the following steps are to grab the tarball from the 4.1 developer tools source, unpack & compile it, then install it into the right places.

Instructions

# Grab and unpack the tarball
$ mkdir ~/tmp && cd ~/tmp
$ curl -O http://opensource.apple.com/tarballs/gcc/gcc-5666.3.tar.gz
$ tar zxf gcc-5666.3.tar.gz
$ cd gcc-5666.3
# Setup some stuff it requires
$ mkdir -p build/obj build/dst build/sym
# And then build it. You should go make a cup of tea or five whilst this runs.
$ gnumake install RC_OS=macos RC_ARCHS='i386 x86_64' TARGETS='i386 x86_64' \
SRCROOT=`pwd` OBJROOT=`pwd`/build/obj DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym
# And finally install it
$ sudo ditto build/dst /

And now you should have gcc-4.2 in your $PATH, available to build all the things that llvm-gcc fails to compile.

抱歉!评论已关闭.