List of tools needed to build GHC
Here are the gory details about which programs and tools you need in order to build GHC. For instructions tailored to your particular operating system, see Building/Preparation.
In most cases the configure
script will tell you if you are missing something.
-
GHC
Since GHC itself is written in Haskell and uses GHC extensions, you normally need another, earlier release of GHC to build it. See Cross compilation for building GHC for a new platform.
GHC sources are supposed to be buildable a) with the latest major GHC release, b) with the penultimate major GHC release, c) with GHC built from exactly the same sources. Note that this means you cannot in general build GHC using an arbitrary development snapshot, or a build from say last week. It might work, it might not - we don't guarantee anything.
Thus, for example, to bootstrap GHC 9.5.* snapshot you need either GHC 9.2 or GHC 9.4.
-
Perl
Perl version 5 at least is required. GHC has been known to tickle bugs in Perl, so if you find that Perl crashes when running GHC try updating (or downgrading) your Perl installation. Versions of Perl before 5.6 have been known to have various bugs tickled by GHC, so the configure script will look for version 5.6 or later.
Perl should be put somewhere so that it can be invoked by the
#!
script-invoking mechanism. -
GNU C (
gcc
)Most GCC versions should work with the most recent GHC sources. Expect trouble if you use a recent GCC with an older GHC, though (trouble in the form of mis-compiled code, link errors, and errors from the
ghc-asm
script).If your GCC dies with "internal error"" on some GHC source file, please let us know, so we can report it and get things improved. (Exception: on x86 boxes, you may need to fiddle with GHC's
-monly-N-regs
option; see the User's Guide). -
GNU Make
The GHC build system makes heavy use of features specific to recent versions of GNU
make
, so you must have at least GNU make 3.80 installed in order to build GHC. -
Happy is a parser generator tool for Haskell, and is used to generate GHC's parsers.
If you start from a source tarball of GHC, then you don't need Happy, because we supply the pre-processed versions of the Happy parsers. If you intend to modify the compiler and/or build from a git repository, then you need Happy.
Happy version 1.19.10 or higher is currently required to build GHC. Grab a copy from Happy's Web Page.
-
Alex is a lexical-analyser generator for Haskell, which GHC uses to generate its lexer.
Like Happy, you don't need Alex if you're building GHC from a source tarball, but you do need it if you're modifying GHC and/or building from a git repository.
Alex version 3.1.7 or higher is currently required to build GHC. Alex is written in Haskell. Alex distributions are available from Alex's Web Page.
-
Haddock is a documentation generator for Haskell, used for making the docs for the libraries. If you don't want to build the docs then you don't need haddock.
Haddock is only needed for GHC 6.8.3 and older; GHC 6.10 comes with Haddock.
For GHC 6.8 and older you need a 0.* version of haddock; 2.* versions won't work. -
autoconf
andautomake
These are needed if you intend to build from the darcs/git sources, they are not needed if you just intend to build a standard source distribution.
Version 2.52 or later of the autoconf package is required. NB. version 2.13 will no longer work, as of GHC version 6.1. Version 1.9 of automake is known to work, use others at your own risk.
autoreconf
(from the autoconf package) recursively buildsconfigure
scripts from the correspondingconfigure.ac
andaclocal.m4
files. If you modify one of the latter files, you'll needautoreconf
to rebuild the correspondingconfigure
. -
diff
Most installations should have this by default.
-
lndir
Needed if you want to prepare a source distribution with
make sdist
, and useful for maintaining a separate build tree. -
sed
Most Unix installations and MSYS2 on Windows already come with
sed
, so you're probably OK. GNU sed version 2.0.4 is no good! It has a bug in it that is tickled by the build-configuration. 2.0.5 is OK. Others are probably OK too (assuming we don't create too elaborate configure scripts.) -
Python
Required for running the testsuite. Python version 3 is needed.
-
Sphinx
Required for building the documentation. Sphinx for Python 3 is needed. Python 2 version is not suitable for Unicode.
-
LLVM
Required for compiling code with the
-fllvm
flag enabled (e.g., if you want to build GHC with theperf-llvm
build flavour). Version 3.8 or later is required. See also the LLVM installation page. -
When building versions of GHC older than 6.10.3 for platforms other than Windows, the presence of libedit in source form will enable interactive line editing when running GHCi in a terminal. Since version 6.10.3, GHC uses Haskeline and not editline.
-
TODO Document this. I stumbled on this as a new dependency as a user, but I cannot comment further.
Nofib
See the running NoFib page.