<ChilliX> at least, I managed to build the head on two successive days now! That's not bad.
Recently I had hard time building GHC, The Glorious Glasgow Haskell Compilation System. So I decided to record my experience which I got from Google, IRC and other sources. This refers to darcs (development) version of GHC. Some bits of this can soon change another way, while other can stay.
- This page contains instruction on building GHC. It may seem that following the first 4 links is sufficient, but it's really important to read Using the build system and to set up separate build tree.
- While GHCi in stable releases use
readline, HEAD migrated to
editlinedue to license issues (editline is BSD-licensed, while GNU readline is GPL'ed). So, you need to get recent version of libedit library. Note that one in Debian is very old and editline Haskell bindings won't build with it. For ArchLinux, I wrote PKGBUILD for editline, get it here.
- If you got compile error, the first thing to do is to clean and build from
scratch. That's why I advise to use build trees as pointed above --
make cleanmay miss some autogenerated files.
- Another source of build errors are warnings together with
-Werrorpragma. If you got one, just edit the file and remove
-Werrorfrom top line.
- "Real" compile errors are much less probable, but also possible. Then try asking at #ghc on FreeNode or at email@example.com mailing list.
- If your build succeeds, don't upgrade (i.e.
./darcs-all pull -a) without need. It may not build next time. If you need to upgrade, start with fresh build tree.
- If build (i.e.
make) succeeds, don't run
make install. There are two problems with that.
First, it does not correctly set permissions (I had
umask 077, and after
sudo make installbinaries were not executable by me.
Another thing is that
/usr/local/bin/ghci(which is shell script) has incorrect path to actual binaries in it.
Both problems are more or less easy fixable, but Igloo said there are more issues with
make install. So, the best solution is to use GHC in-place. See instructions on "Using the Build System" page.