Skip to content
Andrew Farmer edited this page Jan 15, 2014 · 26 revisions

Building a patched GHC HEAD for HERMIT:

First, you need to update happy and alex to the very latest versions so they generate correct primops for HEAD.

cabal update
cabal install alex
cabal install happy

Then, build HEAD itself.

# If on windows, uncomment the following line:
# git config --global core.autocrlf false
# NB: on a mac `curl -O` instead of `wget`
git clone git://git.haskell.org/ghc.git
cd ghc
# no-dph saves you time by not compiling DPH, use as needed
./sync-all --no-dph get 
# BEGIN - Only for hermit-syb (which needs modified base libraries for inlining info)
# cd libraries
# rm -rf base/
# git clone http://michaeldadams.org/projects/hermit/base.git
# cd ghc-prim
# wget http://michaeldadams.org/projects/hermit/ghc.diff-inline-list-eq
# git apply ghc.diff-inline-list-eq
# cd ../..
# END - Only for hermit-syb
# saves some headaches
git config --global diff.ignoreSubmodules dirty
# set up mk/build.mk
cp mk/build.mk.sample mk/build.mk

Now edit mk/build.mk

uncomment: BuildFlavour = quick

change: GhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)

to: GhcLibWays = p $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)

Now build ghc with the following three commands (and grab drink of your choice):

perl boot
./configure
make

See: http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation if you have problems here.

Once done, symlink the stage2 compiler.

cd inplace/bin
ln -s ghc-stage2 ghc
pwd

add the result of pwd to the beginning of your PATH. With the symlink, should allow you to use your existing cabal with your newly compiled GHC HEAD try: which ghc and ghc -V to make sure the right one is being used

Now to build HERMIT itself:

cabal update
# kure
git clone https://github.com/ku-fpg/kure.git
cd kure
cabal install
cd ..
# BEGIN only if running hermit-syb
# syb
git clone http://michaeldadams.org/projects/hermit/syb.git
cd syb
cabal install
cd ..
# haskell-src
git clone git://github.com/haskell-pkg-janitors/haskell-src.git
cd haskell-src
wget http://michaeldadams.org/projects/hermit/haskell-src.diff-expose-all-unfoldings
git apply haskell-src.diff-expose-all-unfoldings
cabal install
cd ..
# END only if running hermit-syb
# hermit
git clone [email protected]:ku-fpg/hermit.git
cd hermit
cabal install
cd ..

Now you should be able to run HERMIT with GHC HEAD.

Clone this wiki locally