Build GHC in Vagrant
Created at 2016-08-08T13:35:37.000Z

This is my first time to build GHC from source. I tried this process at this point:

Get source code

$ git clone --depth 1 git://
$ cd ghc

Edit Vagrantfile

The prepared Vagrantfile didn't work for me (or I don't know how to use), so I wrote script by myself.

# -*- mode: ruby -*-
# vi: set ft=ruby :

$script = <<SCRIPT
set -x

curl -sSL | sh

su vagrant -c 'stack setup'
su vagrant -c 'stack install happy'
su vagrant -c 'stack install alex'

apt-get install -y autoconf automake git llvm-dev libedit-dev libffi-dev libncurses5-dev

echo 'export PATH="$(stack path --compiler-bin):$PATH"' >> /home/vagrant/.bashrc
echo 'export PATH="$(stack path --local-bin):$PATH"' >> /home/vagrant/.bashrc


Vagrant.configure(2) do |config| = "ubuntu/trusty64"
  config.vm.provision :shell, inline: $script
  config.vm.provider "virtualbox" do |vb|
    vb.gui = false
    vb.memory = 4096
    vb.cpus = 2

Run commands

$ vagrant up
$ vagrant ssh
(vm)$ cd /vagrant
(vm)$ git config --global url."git://".insteadOf git://
(vm)$ cp mk/ mk/
(vm)$ git submodule update --init
(vm)$ ./boot
(vm)$ ./configure
(vm)$ make # I felt like this took half a day
(vm)$ ./inplace/bin/ghc-stage2 --interactive
GHCi, version 8.1.20160801:  :? for help
Prelude> sum [1..100]
Prelude> :q
Leaving GHCi.
(vm)$ make fasttest
(vm)$ cat testsuite_summary.txt

Unexpected results from:
TEST="T9203 haddock.Cabal haddock.base T1969 T5837 T3294"

SUMMARY for test run started at Mon Aug  8 05:02:29 2016 UTC
 3:43:44 spent to go through
    5272 total tests, which gave rise to
   21055 test cases, of which
   15894 were skipped

      50 had missing libraries
    5031 expected passes
      74 expected failures

       0 caused framework failures
       0 unexpected passes
       0 unexpected failures
       6 unexpected stat failures

Unexpected stat failures:
   perf/compiler/         T1969 [stat not good enough] (normal)
   perf/compiler/         T3294 [stat not good enough] (normal)
   perf/compiler/         T5837 [stat too good] (normal)
   perf/haddock/   haddock.base [stat too good] (normal)
   perf/haddock/  haddock.Cabal [stat too good] (normal)
   perf/should_run/       T9203 [stat too good] (normal)

I don't know what this test result means, but anyway I somehow managed to build GHC.