Building the Glasgow Functional Programming Tools Suite

The GHC Team

January 2000

This guide is intended for people who want to build or modify programs from the Glasgow fptools suite (as distinct from those who merely want to run them). Installation instructions are now provided in the user guide.

The bulk of this guide applies to building on Unix systems; see Section 9 for Windows notes.

Table of Contents
1. Getting the Glasgow fptools suite
2. Things to check before you start typing
3. What machines the Glasgow tools run on
4. Installing pre-supposed utilities
5. Building from source
6. The Makefile architecture
7. Booting/porting from C (.hc) files
8. Known pitfalls in building Glasgow Haskell
9. Notes for building under Windows

1. Getting the Glasgow fptools suite

Building the Glasgow tools can be complicated, mostly because there are so many permutations of what/why/how, e.g., ``Build Happy with HBC, everything else with GHC, leave out profiling, and test it all on the `real' NoFib programs.'' Yeeps!

Happily, such complications don't apply to most people. A few common ``strategies'' serve most purposes. Pick one and proceed as suggested:

Binary distribution.

If your only purpose is to install some of the fptools suite then the easiest thing to do is to get a binary distribution. In the binary distribution everything is pre-compiled for your particular machine architecture and operating system, so all you should have to do is install the binaries and libraries in suitable places. The user guide describes how to do this.

A binary distribution may not work for you for two reasons. First, we may not have built the suite for the particular architecture/OS platform you want. That may be due to lack of time and energy (in which case you can get a source distribution and build from it; see below). Alternatively, it may be because we haven't yet ported the suite to your architecture, in which case you are considerably worse off.

The second reason a binary distribution may not be what you want is if you want to read or modify the souce code.

Source distribution.

You have a supported platform, but (a) you like the warm fuzzy feeling of compiling things yourself; (b) you want to build something ``extra''—e.g., a set of libraries with strictness-analysis turned off; or (c) you want to hack on GHC yourself.

A source distribution contains complete sources for one or more projects in the fptools suite. Not only that, but the more awkward machine-independent steps are done for you. For example, if you don't have flex you'll find it convenient that the source distribution contains the result of running flex on the lexical analyser specification. If you don't want to alter the lexical analyser then this saves you having to find and install flex. You will still need a working version of GHC on your machine in order to compile (most of) the sources, however.

We make source distributions more frequently than binary distributions; a release that comes with pre-compiled binaries is considered a major release, i.e., a release that we have some confidence will work well by having tested it (more) thoroughly.

Source-only distributions are either bugfix releases or snapshots of current state of development. The release has undergone some testing. Source releases of GHC 4.xx can be compiled up using GHC 2.10 or later.

Build GHC from intermediate C .hc files:

You need a working GHC to use a source distribution. What if you don't have a working GHC? Then you have no choice but to ``bootstrap'' up from the intermediate C (.hc) files that we provide. Building GHC on an unsupported platform falls into this category. Please see Section 7.

Once you have built GHC, you can build the other Glasgow tools with it.

In theory, you can (could?) build GHC with another Haskell compiler (e.g., HBC). We haven't tried to do this for ages and it almost certainly doesn't work any more (for tedious reasons).

The CVS repository.

We make source distributions slightly more often than binary distributions; but still infrequently. If you want more up-to-the minute (but less tested) source code then you need to get access to our CVS repository.

All the fptools source code is held in a CVS repository. CVS is a pretty good source-code control system, and best of all it works over the network.

The repository holds source code only. It holds no mechanically generated files at all. So if you check out a source tree from CVS you will need to install every utility so that you can build all the derived files from scratch.

More information about our CVS repository is available in the FPTools CVS Cheat Sheet.

If you are going to do any building from sources (either from a source distribution or the CVS repository) then you need to read all of this manual in detail.