Snow Leopard GHC

Simon Marlow marlowsd at
Thu Sep 24 05:28:51 EDT 2009

On 24/09/2009 09:55, Barney Stratford wrote:
> 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
> --- 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
> --target=x86_64-apple-darwin
> make
> 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.

Nice going - sounds like you've got the furthest so far.  Others have 
been going via an unregisterised build, which seems to be more 
problematic (though it shouldn't be).

It should be possible to use your 6.8.3 to bootstrap your way to 6.12.1, 
have you tried that?  I doubt it will fix your GHCi problems, though. 
But it should be possible to then make a distribution for others to try.


More information about the Glasgow-haskell-users mailing list