Skip to content
xich edited this page Apr 23, 2013 · 26 revisions

Building a patched GHC HEAD for HERMIT:

# If on windows, uncomment the following line:
# git config --global core.autocrlf false
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 syb-opt (which needs modified base libraries for inlining info)
# cd libraries
# rm -rf base/
# git clone http://michaeldadams.org/projects/hermit/base.git
# cd ..
# END - Only for syb-opt
# saves some headaches
git config --global diff.ignoreSubmodules dirty
# apply the space leak patch
# on a mac: `curl -O` instead of `wget`
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 (and grab drink of your choice): See: http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation if you have problems here.

perl boot
./configure
make

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 we need to build all the libraries HERMIT depends on. Cabal can take care of this for the most part, but some libraries need to be patched to work with HEAD.

cabal update
# need a version >= 0.11.2.3
# for some reason the modular solver pulls in an older version of bytestring
# than what comes with GHC HEAD, which will break things for you later
cabal install text --solver=topdown
# 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 ..
# unordered-containers - patched for HEAD
wget http://www.ittc.ku.edu/~afarmer/unordered-containers-0.2.3.0.tar.gz
tar -xvzf unordered-containers-0.2.3.0.tar.gz
cd unordered-containers-0.2.3.0
cabal install
cd ..
# blaze-builder - patched for HEAD
wget http://www.ittc.ku.edu/~afarmer/blaze-builder-0.3.1.0.tar.gz
tar -xvzf blaze-builder-0.3.1.0.tar.gz
cd blaze-builder-0.3.1.0
cabal install
cd ..
# aeson - patched for HEAD
wget http://www.ittc.ku.edu/~afarmer/aeson-0.6.1.0.tar.gz
tar -xvzf aeson-0.6.1.0.tar.gz
cd aeson-0.6.1.0
cabal install
cd ..
# You'll need happy >= 1.18.6 to build HERMIT
# But as happy is an application, you don't need to build it with GHC HEAD
# 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