Building GHC on OS X

David Kirkman dkirkman at gmail.com
Tue Aug 8 20:37:13 EDT 2006


Hi,

I've been using ghc on Mac OS X for a while now, so when I noticed
Simon Marlow's call (made last month, but I just noticed it) for people
to help with OS X, I thought, why not?

Well, it turns out that I can't even build ghc, so I'm not likely to
end up being much help.  But it would be nice to at least be able to
build the thing, so if anybody can help me...

I'm trying to build GHC (6.5.?? ... version from darcs.haskell.org as
of yesterday) on Mac OS X (10.4.7 ppc) bootstrapping from ghc 6.4.2
and gcc 4.0.1.

"./configure; make" does not work.  On my initial try, I ran into the
UNDO_DELETE, etc problems associated with Darwin's partial readline
support described in ticket #766.  The fix suggested in that ticket
seems to work fine, but not until I installed the GNU readline library.
(If the change to detect the broken Darwin readline is in the  
repository,
it did not work for me).

After fixing the readline problem, it looks like I can build at least
part of the stage1 compiler -- but the build fails just after starting
to build stage2.  The final error is:

 > ../compiler/ghc-inplace -H32m -O0 -W -fno-warn-unused-matches - 
fwarn-unused-imports  -istage2/utils  -istage2/basicTypes  -istage2/ 
types  -istage2/hsSyn  -istage2/prelude  -istage2/rename  -istage2/ 
typecheck  -istage2/deSugar  -istage2/coreSyn  -istage2/specialise  - 
istage2/simplCore  -istage2/stranal  -istage2/stgSyn  -istage2/ 
simplStg  -istage2/codeGen  -istage2/main  -istage2/profiling  - 
istage2/parser  -istage2/cprAnalysis  -istage2/ndpFlatten  -istage2/ 
iface  -istage2/cmm  -istage2/nativeGen  -istage2/ghci -Istage2 - 
DGHCI -DBREAKPOINT -package template-haskell -threaded -cpp -fglasgow- 
exts -fno-generics -Rghc-timing -I. -IcodeGen -InativeGen -Iparser - 
package unix -package Cabal -ignore-package lang -recomp -Rghc-timing  
-DDEBUG  -H16M '-#include "hschooks.h"' -package-name  ghc-6.5   - 
fgenerics  -O  -c utils/FastString.lhs -o stage2/utils/FastString.o  - 
ohi stage2/utils/FastString.hi
 >
 > utils/FastString.lhs:73:0:
 >     Failed to load interface for `GHC.Exts':
 > 	Could not find module `GHC.Exts':
 > 	  use -v to see a list of the files searched for
 > <<ghc: 52487092 bytes, 5 GCs, 19236/19236 avg/max bytes residency  
(1 samples), 16M in use, 0.00 INIT (0.00 elapsed), 0.29 MUT (0.38  
elapsed), 0.03 GC (0.04 elapsed) :ghc>>
 > make[2]: *** [stage2/utils/FastString.o] Error 1
 > make[1]: *** [stage2] Error 2
 > make: *** [bootstrap2] Error 2


The first error that I can find comes when building ghc/libraries/ 
base (in stage1)

 > ../../compiler/ghc-inplace -H32m -O0 -W -fno-warn-unused-matches - 
fwarn-unused-imports -fglasgow-exts -cpp -Iinclude -"#include"  
HsBase.h -funbox-strict-fields -package-name  base-1.0 -O -dcore-lint  
-W -fno-warn-unused-matches -fwarn-unused-imports -keep-hc-files   - 
fgenerics    -c Data/Generics/Schemes.hs -o Data/Generics/Schemes.o  - 
ohi Data/Generics/Schemes.hi

 > Data/Generics/Schemes.hs:108:15:
 >     Couldn't match expected type `r' (a rigid variable)
 > 	   against inferred type `[a]'
 >      `r' is bound by the type signature for `listify'
 > 	at Data/Generics/Schemes.hs:106:20
 >       Expected type: r -> r -> r
 >       Inferred type: [a] -> [a] -> [a]
 >     In the first argument of `everything', namely `(++)'
 >     In the call (everything (++)
 >			    ([] `mkQ` (\ x -> if p x then [x] else [])))
 > make[2]: *** [Data/Generics/Schemes.o] Error 1

After that, there are a handful of errors complaining about things that
can't be found (e.g.)

 > CPUTime.hs:5:0:
 >    Failed to load interface for `System.CPUTime':
 >	Could not find module `System.CPUTime':
 >	  use -v to see a list of the files searched for
 > make[2]: *** [CPUTime.o] Error 1

and

 > Language/Haskell/TH/Syntax.hs:46:0:
 >    Failed to load interface for `Data.PackedString':
 >	Could not find module `Data.PackedString':
 >	  use -v to see a list of the files searched for
 > make[2]: *** [Language/Haskell/TH/Syntax.o] Error 1

There are six or seven more messages like those, but nothing severe  
enough to
stop make until the problem where it can not find 'GHC.Exts'.

I tried to brute force it with 'make -k', which went a lot further,
but in the end build nothing useful.

Anybody have any ideas?  Or build instructions for OS X?

Thanks,

-david k.



More information about the Glasgow-haskell-users mailing list