By far the easiest way I know of to get a build of GHC is via the tools 'stack' and 'hadrian'
Setup
- Ubuntu:
curl -sSL https://get.haskellstack.org/ | sh stack setup
- macOS:
/usr/bin/ruby -e \ "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install autoconf automake gmp curl -sSL https://get.haskellstack.org/ | sh stack setup
- Windows:
curl -sSL https://get.haskellstack.org/ | sh stack setup stack exec -- pacman -S autoconf automake-wrapper make patch python tar \ --noconfirm
Build
- Ubuntu & macOS:
git clone --recursive https://gitlab.haskell.org/ghc/ghc.git cd ghc hadrian/build.stack.sh --configure --flavour=quickest -j
- Windows:
git clone --recursive https://gitlab.haskell.org/ghc/ghc.git cd ghc hadrian/build.stack.bat --configure --flavour=quickest -j
[*] The simplicitly and uniformity of these commands make me an advocate of these tools and in particular, the hadrian
--configure
flag.
[**] Well, that is to say mostly work. The above is the ideal and has worked me for me reliably for the last year. Recently though, for one reason or another, there seem to have been a lot of breakages. Your mileage may vary.