Building snapshot ghc-5.05.20030123 on macOSX

Arthur Baars arthurb@cs.uu.nl
Wed, 12 Feb 2003 20:06:10 +0100


I want to play a bit with Template Haskell, so I downloaded a cvs 
snapshot (ghc-5.05.20030123.tar.gz) and tried to compile
it on my mac (OSX 10.2).  I figured out that I needed a stage2 or 
stage3 compiler to get TH working, so I tried 'make stage3' .
GHC started to compile itself three times. At lot of hours later it 
finished.

Unfortunately, when I tried run the thing on a Prinf example, I got the 
following message.
compiler/stage3-> ./ghc-inplace -c Printf.hs -fglasgow-exts -package 
haskell-src
Template Haskell  bracket illegal in a stage-1 compiler
   [| \s -> s |]

The thing in"compiler/stage3"  was just a stage-1 compiler, so ghc had 
achieved nothing useful after re-compiling three times :-(
The problem is that GHCi support is not turned on for MacOSX. I guess 
GHCi is used to do compile-time evaluation of code for TH.

In file "mk/config.mk.in" it says:

# Include GHCi in the compiler.  Default to NO for the time being.

ifneq "$(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 
freebsd netbsd openbsd)" ""
GhcWithInterpreter=YES
else
GhcWithInterpreter=NO
endif

In the list of supported systems MacOSX is missing. After adding 
"darwin" to this list, and waiting for hours, I got a working 
TH-compiler.

Can someone add OSX("darwin") to the "mk/config.mk.in" file? It would 
also be nice to get a warning
if one tries to compile a stage-(N>1) compiler without GHCi support.

Cheers,

Arthur