Updated on 4 Dec 2013.
I upgraded to Mavericks and Xcode 5. There is still "gcc" but it is in fact "clang":
% which gcc /usr/bin/gcc % gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix
Which introduced this "gcc", Mavericks or Xcode 5? I don't know. This "gcc" does not accept some "gcc" options. So, GHC head cannot be built.
This article describes how to build GHC head on Mavericks with Xcode 5.
Installing Command Line Tools
The way to install Command Line Tools on Mavericks is different from that of Mountain Lion. I don't know this is required for GHC build but the following procedure does this:
% xcode-select --install
Sequence of GHC build
I have the following "build.mk":
% cat mk/build.mk InstallExtraPackages = YES
The following is my sequence to build GHC:
% make maintainer-clean % perl boot % ./configure % make -j 3
Pitfalls
The command name of "gcc" is hard-coded in some tools including "hsc2hs". So, the name of "gcc" is important. The following does NOT work:
% ./configure --with-gcc=
You need to make a symbolic link to your C compiler if its name is not "gcc".
If you installed 32bit GHC 7.6.3, you will get troubles. I recommend to install 64bit GHC 7.6.3 instead.
After installing proper "gcc" as described later, you need to modify the "C compiler command" entry of "/Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/settings".
Building GHC with clang
You need to install clang-xcode5-wrapper. Even if you don't modify "settings", the following works.
% ghc clang-xcode5-wrapper.hs % sudo cp clang-xcode5-wrapper /usr/local/bin/gcc
And you need to install alex 3.1.3 and happy 1.19.2.
Then "settings" should have:
("C compiler command", "/usr/local/bin/gcc"),
So far, "integer-gmp" cannot be built. So, you should add the following to "mk/build.mk":
INTEGER_LIBRARY = integer-simple
If you want to build GHC head with integer-gmp, apply this patch.