Skip to content

Instantly share code, notes, and snippets.

@lukexi
Last active November 2, 2019 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukexi/6191728 to your computer and use it in GitHub Desktop.
Save lukexi/6191728 to your computer and use it in GitHub Desktop.
Building GHC HEAD on OS X 10.9 Mavericks
1) I installed LLVM 3.4
brew install llvm --with-clang --HEAD
2) I used this build.mk:
HADDOCK_DOCS = NO
BUILD_DOCBOOK_HTML = NO
BUILD_DOCBOOK_PS = NO
BUILD_DOCBOOK_PDF = NO
SPLIT_OBJS = NO
INTEGER_LIBRARY = integer-simple
3) Austin let me know I needed to pass "-x assembler-with-cpp" to clang when in preprocessor mode, so I wrote a wrapper clang.hs, compiled it, put it in my path, and changed /usr/local/lib/ghc-7.6.2/settings to use it. (it also passes some flags Carter suggested, along with extra include flags, which were necessary as of a couple weeks ago but might have been fixed in the newer DPs)
https://github.com/ghc-ios/ghc-ios-scripts/blob/master/clang-xcode5-wrapper.hs
4) I used
./configure --with-gcc=clang
(where clang is the wrapper script above)
5) "inplace/bin/mkdirhier" bootstrapping/. failed mysteriously, so I manually created bootstrapping/ in the ghc build dir.
6) DTrace failed with an "unsupported compiler" error during compilation, so I killed that section in configure.ac
# if test -n "$DtraceCmd"; then
# if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then
# HaveDtrace=YES
# fi
# fi
7) I got the error:
libraries/integer-simple/GHC/Integer/Type.hs:836:50:
Not in scope: ‛.’
libraries/integer-simple/GHC/Integer/Type.hs:847:67:
Not in scope: ‛.’
I hacked through this by manually find-and-replacing WORD_SIZE_IN_BITS with 64 in Type.hs.
And that's it! make && make install ran to completion and some simple test programs seem to compile and run fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment