CONTENT="Modular DocBook HTML Stylesheet Version 1.64
Installing from binary distributions is easiest, and recommended! (Why binaries? Because GHC is a Haskell compiler written in Haskell, so you've got to bootstrap it somehow. We provide machine-generated C-files-from-Haskell for this purpose, but it's really quite a pain to use them. If you must build GHC from its sources, using a binary-distributed GHC to do so is a sensible way to proceed. For the other fptools programs, many are written in Haskell, so binary distributions allow you to install them without having a Haskell compiler.)
This guide is in several parts:
For certain platforms, we provide GHC binaries packaged using the native package format for the platform. This is likely to be by far the best way to install GHC for your platform if one of these packages is available, since dependencies will automatically be handled and the package system normally provides a way to uninstall the package at a later date.
We generally provide the following packages:
Other platform-specific packages may be available, check the GHC download page for details.
Binary distributions come in “bundles,” one bundle per file called bundle-platform.tar.gz. (See the building guide for the definition of a platform.) Suppose that you untar a binary-distribution bundle, thus:
Then you should find a single directory, ghc-version, with the following structure:
OK, so let's assume that you have unpacked your chosen bundles into a scratch directory fptools. What next? Well, you will at least need to run the configure script by changing your directory to fptools and typing ./configure. That should convert Makefile.in to Makefile.
You can now either start using the tools in-situ without going through any installation process, just type make in-place to set the tools up for this. You'll also want to add the path which make will now echo to your PATH environment variable. This option is useful if you simply want to try out the package and/or you don't have the necessary privileges (or inclination) to properly install the tools locally. Note that if you do decide to install the package `properly' at a later date, you have to go through the installation steps that follow.
To install an fptools package, you'll have to do the following:
When installing the user-invokable binaries, this installation procedure will install GHC as ghc-x.xx where x.xx is the version number of GHC. It will also make a link (in the binary installation directory) from ghc to ghc-x.xx. If you install multiple versions of GHC then the last one “wins”, and “ghc” will invoke the last one installed. You can change this manually if you want. But regardless, ghc-x.xx should always invoke GHC version x.xx.
There are plenty of “non-basic” GHC bundles. The files for them are called ghc-x.xx-bundle-platform.tar.gz, where the platform is as above, and bundle is one of these:
One likely scenario is that you will grab two binary bundles—basic, and profiling. We don't usually make the rest, although you can build them yourself from a source distribution.
The various GHC bundles are designed to be unpacked into the same directory; then installing as per the directions above will install the whole lot in one go. Note: you must at least have the basic GHC binary distribution bundle, these extra bundles won't install on their own.
The way to do this is, of course, to compile and run this program (in a file Main.hs):
Compile the program, using the -v (verbose) flag to verify that libraries, etc., are being found properly:
Now run it:
Some simple-but-profitable tests are to compile and run the notorious nfib program, using different numeric types. Start with nfib :: Int -> Int, and then try Integer, Float, Double, Rational and perhaps the overloaded version. Code for this is distributed in ghc/misc/examples/nfib/ in a source distribution.
For more information on how to “drive” GHC, read on...