Snow Leopard GHC
barney_stratford at fastmail.fm
Thu Sep 24 04:55:59 EDT 2009
Latest update on getting GHC working 64-bit on Snow Leopard. I've been
building 6.8.3, simply because it was the version I had running before
so might give fewer problems.
To get the compiler working, apply this patch (which I borrowed from
the Darcs repository):
diff -uit a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
@@ -816,6 +816,10 @@
pprDynamicLinkerAsmLabel :: DynamicLinkerLabelInfo -> CLabel -> SDoc
#if x86_64_TARGET_ARCH && darwin_TARGET_OS
+pprDynamicLinkerAsmLabel CodeStub lbl
+ = char 'L' <> pprCLabel lbl <> text "$stub"
+pprDynamicLinkerAsmLabel SymbolPtr lbl
+ = char 'L' <> pprCLabel lbl <> text "$non_lazy_ptr"
pprDynamicLinkerAsmLabel GotSymbolPtr lbl
= pprCLabel lbl <> text "@GOTPCREL"
pprDynamicLinkerAsmLabel GotSymbolOffset lbl
Make sure you have a working 32-bit GHC as well as libraries (libgmp,
etc).for both 32 and 64-bit architectures. Then say
./configure --build=x86_64-apple-darwin --host=x86_64-apple-darwin --
It will compile an x86_64 GHC for you, happily unaware that the GHC
you're using for the build is a 32-bit one. The stage1 compiler is, of
course, a 32-bit binary that produces 64-bit binaries.
I found that the resulting compiler can build itself (stage3) and can
say Hello World, so it looks like it works correctly. I've still not
got GHCi working, though.
I've managed to narrow down the source of the trouble with the linker
in GHCi, and it looks like there are some bugs as well as missing
parts, which is why it kept launching itself to the moon. Still
working on that one: patch to follow. For now, you can at least
compile your code and run it non-interactively.
More information about the Glasgow-haskell-users