Skip to content
Andrew Farmer edited this page May 21, 2013 · 26 revisions

Building a patched GHC HEAD for HERMIT:

# If on windows, uncomment the following line:
# git config --global core.autocrlf false
# NB: on a mac `curl -O` instead of `wget`
git clone http://darcs.haskell.org/ghc.git/
cd ghc
# no-dph saves you time by not compiling DPH, use as needed
./sync-all --testsuite --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
# apply the space leak patch
wget http://hackage.haskell.org/trac/ghc/raw-attachment/ticket/7702/Fix-thunk-leak-in-CoreM-s-CoreWriter-7702.patch
git am Fix-thunk-leak-in-CoreM-s-CoreWriter-7702.patch
# 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 = v dyn p

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 also, edit your ~/.cabal/config to uncomment (or add) the following:

    shared: True

Now to build HERMIT itself:

cabal update
# kure
git clone https://github.com/ku-fpg/kure.git
cd kure
cabal install
cd ..
# syb - if running syb-opt
git clone http://michaeldadams.org/projects/hermit/syb.git
cd syb
cabal install
cd ..
# hermit
git clone git@github.com:ku-fpg/hermit.git
cd hermit
cabal install
cd ..

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

Clone this wiki locally