Building GHC for Mac OS X 10.5

Sean Leather leather at cs.uu.nl
Thu Oct 13 17:18:02 CEST 2011


After many years, I have once again attempted to build GHC from source. The
experience went much easier than in the past.

This time, my system is running the now-old 10.5 (Leopard) using Xcode
3.1.4. I'm probably the only one who wants to build on 10.5, but I still
appreciate the fact that GHC can be built on a variety of systems, allowing
more people (like me) to hack on it.

I ran into a few minor issues when building.

(1) I had a problem with gmp. No surprise, and I didn't want to fight it, so
I built with integer-simple by adding INTEGER_LIBRARY=integer-simple to
./mk/build.mk .

(2) It appears that integer-simple has a copy-paste bug that was easy to
fix:

$ cd libraries/integer-simple/
$ git diff
diff --git a/GHC/Integer/Type.hs b/GHC/Integer/Type.hs
index 02eeef2..f620e67 100644
--- a/GHC/Integer/Type.hs
+++ b/GHC/Integer/Type.hs
@@ -97,8 +97,8 @@ integerToInt i = word2Int# (integerToWord i)
 integerToWord64 :: Integer -> Word64#
 integerToWord64 i = int64ToWord64# (integerToInt64 i)

-{-# NOINLINE word64ToInteger:: #-}
-word64ToInteger:: Word64# -> Integer
+{-# NOINLINE word64ToInteger #-}
+word64ToInteger :: Word64# -> Integer
 word64ToInteger w = if w `eqWord64#` wordToWord64# 0##
                     then Naught
                     else Positive (word64ToPositive w)

(3) A linker flag was added for Xcode 4 that is not available in 3.1.

$ git diff
diff --git a/compiler/main/DriverPipeline.hs
b/compiler/main/DriverPipeline.hs
index b655425..ec8024d 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1682,10 +1682,12 @@ linkBinary dflags o_files dep_packages = do
                       -- like
                       --     ld: warning: could not create compact unwind
for .LFB3: non-standard register 5
                       -- on x86.
+{-
                       ++ (if platformOS   (targetPlatform dflags) ==
OSDarwin   &&
                              platformArch (targetPlatform dflags) `elem`
[ArchX86, ArchX86_64]
                           then ["-Wl,-no_compact_unwind"]
                           else [])
+-}

                       -- '-Wl,-read_only_relocs,suppress'
                       -- ld gives loads of warnings like:

I think the fix to integer-simple should be applied, since it's an obvious
improvement.

I suspect the last issue might be controversial, since it seems to involve
an apparently incompatible difference between the older and newer Xcode
versions. Of course, I would like to see the older version still supported,
but, as I said, I may be among a very small minority in this vote.

Regards,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20111013/4c304e36/attachment.htm>


More information about the Glasgow-haskell-users mailing list