Installing from binary distributionsbinary installationsinstallation, of binaries
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 two parts: installing on Unix-a-likes, and installing on Windows.Installing on Unix-a-likesBundle structurebundles of binary stuff
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:
% cd /your/scratch/space
% gunzip < ghc-x.xx-sun-sparc-solaris2.tar.gz | tar xvf -
Then you should find a single directory, fptools, with the following
structure:
binary distribution, layoutdirectory layout (binary distributions)Makefile.in
the raw material from which the Makefile
will be made ().
configure
the configuration script ().
README
Contains this file summary.
INSTALL
Contains this description of how to install
the bundle.
ANNOUNCE
The announcement message for the bundle.
NEWS
release notes for the bundle—a longer version
of ANNOUNCE. For GHC, the release notes are contained in the User
Guide and this file isn't present.
bin/<platform>
contains platform-specific executable
files to be invoked directly by the user. These are the files that
must end up in your path.
lib/<platform>/
contains platform-specific support
files for the installation. Typically there is a subdirectory for
each fptools project, whose name is the name of the project with its
version number. For example, for GHC there would be a sub-directory
ghc-x.xx/ where x.xx is the version number of GHC in the bundle.
These sub-directories have the following general structure:
libHSstd.a etc:
supporting library archives.
ghc-iface.prl etc:
support scripts.
import/Interface files (.hi) for the prelude.
include/
A few C #include files.
share/
contains platform-independent support files
for the installation. Again, there is a sub-directory for each
fptools project.
html/
contains HTML documentation files (one
sub-directory per project).
man/
contains Unix manual pages.
This structure is designed so that you can unpack multiple bundles
(including ones from different releases or platforms) into a single
fptools directory
this doesn't work at the
moment
:
% cd /your/scratch/space
% gunzip < ghc-x.xx-sun-sparc-solaris2.tar.gz | tar xvf -
% gunzip < happy-x.xx-sun-sparc-sunos4.tar.gz | tar xvf -
When you do multiple unpacks like this, the top level Makefile,
README, and INSTALL get overwritten each time.
That's fine—they should be the same. Likewise, the
ANNOUNCE-<bundle> and NEWS-<bundle>
files will be duplicated across multiple platforms, so they will be
harmlessly overwritten when you do multiple unpacks. Finally, the
share/ stuff will get harmlessly overwritten when you do
multiple unpacks for one bundle on different platforms.
Installing
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 configureconfigure script by changing your
directory to fptools and typing ./configure. That should convert
Makefile.in to Makefile.
installing in-placein-place installation
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
follows.
To install an fptools package, you'll have to do the following:
Edit the Makefile and check the settings of the following variables:
directories, installationinstallation directoriesplatform
the platform you are going to install for.
bindir
the directory in which to install user-invokable
binaries.
libdir
the directory in which to install
platform-dependent support files.
datadir
the directory in which to install
platform-independent support files.
infodir
the directory in which to install Emacs info
files.
htmldir
the directory in which to install HTML
documentation.
dvidir
the directory in which to install DVI
documentation.
The values for these variables can be set through invocation of the
configureconfigure
script that comes with the distribution, but doing an optical diff to
see if the values match your expectations is always a Good Idea.
Instead of running configure, it is
perfectly OK to copy Makefile.in to
Makefile and set all these variables directly
yourself. But do it right!
Run make install. This
should work with ordinary Unix
make—no need for fancy stuff like GNU
make.
rehash (t?csh or zsh users), so your shell will see the new
stuff in your bin directory.
Once done, test your “installation” as suggested in
. Be sure to use a -v
option, so you can see exactly what pathnames it's using.
If things don't work as expected, check the list of known pitfalls in
the building guide.
link, installed as ghc
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.
What bundles there arebundles, binary
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:
prof:
Profiling with cost-centres. You probably want this.
profiling bundlesbundles, profilingpar:
Parallel Haskell features (sits on top of PVM).
You'll want this if you're into that kind of thing.
parallel bundlesbundles, parallelgran:
The “GranSim” parallel-Haskell simulator
(hmm… mainly for implementors).
bundles, gransimgransim bundlesticky:
“Ticky-ticky” profiling; very detailed
information about “what happened when I ran this program”—really
for implementors.
bundles, ticky-tickyticky-ticky bundles
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.
Testing that GHC seems to be working
testing a new GHC
The way to do this is, of course, to compile and run this program
(in a file Main.hs):
main = putStr "Hello, world!\n"
Compile the program, using the -v (verbose) flag to verify that
libraries, etc., are being found properly:
% ghc -v -o hello Main.hs
Now run it:
% ./hello
Hello, world!
Some simple-but-profitable tests are to compile and run the notorious
nfibnfib 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, either do ghc -help or
consult the User's Guide (distributed in several pre-compiled formats
with a binary distribution, or in source form in
ghc/docs/users_guide in a source distribution).
Installing on Windows
Getting the Glasgow Haskell Compiler (GHC) to run on Windows platforms can
be a bit of a trying experience. This document tries to simplify the task by
enumerating the steps you need to follow in order to set up and configure
your machine to run GHC (at least that's the intention ;-)
System requirements
An installation of GHC requires ca. 200M of disk space, which is split
roughly 50-50 between GHC and the supporting software. To run GHC
comfortably, your machine should have at least 64M of memory.
Software required
You need two chunks of software other than GHC itself: the Cygwin toolchain, and Perl. Here's how to get and install them.
The cygwin toolchain (1.1)
GHC depends at the moment on the cygwin tools to operate, which
dresses up the Win32 environment into something more UNIX-like.
(notably, it provides gcc, as and ld),
so you'll need to install these tools first. You also need
Cygwin to use CVS. (We don't yet support later versions of Cygwin.)
Important grungy information about Cygwin:
Cygwin doesn't deal well with filenames that include
spaces. "Program Files" and "Local files" are
common gotchas.
Cygwin implements a symbolic link as a text file with some
magical text in it. So programs that don't use Cygwin's
I/O libraries won't recognise such files as symlinks.
In particular, programs compiled by GHC are meant to be runnable
without having Cygwin, so they don't use the Cygwin library, so
they don't recognise symlinks.
Here's how to install Cygwin.
Install Cygwin 1.1 from sources.redhat.com Install
this into your root directory (C:\), despite the
warnings (but you may want to back up C:\bin,
C:\etc, C:\lib,
C:\usr and C:\var first) and
choose DOS text mode. If you're upgrading from Cygwin B20.1, running
mount --import-old-mounts immediately after installation
may help. Either way, you want to end up with your main drive mounted in
textmode, and only the
bin directories mounted in binmode
(you can check by running mount).
Create the following directories (if they aren't already there; substitute
the drive you installed Cygwin on for c:):
c:/Tempc:/etcc:/binc:/usr/local/bin
(using mkdir -p /bin, etc.)
If you're an Emacs user and want to be able to run bash
from within a shell buffer, see the NT Emacs home page for
instructions on how to set this up.
Environment variables
In case you don't already know how to set environment variables on a Windows
machine, here's how. On WinNT/Win2k, to edit your PATH
variable (for example), do the following:
Press Start/Settings/Control PanelsDouble-click SystemPress AdvancedPress Environment VariablesUnder System Variables, select PATHPress EditAdd ";C:/whatever/" to the end of the string (for example)Press OK
Some environment variables are “user variables” and
some are “system variables”. I'm not sure of the difference
but both are changed though the same dialogue.
In addition, when running bash
you can set environment variables in your .bashrc file.
But it is better to set your environment variables from the
control panel (they get inherited by bash) because then they are visible
to applications that aren't started by bash. For example,
when you're invoking CVS (and ssh) via Emacs keybindings;
it invokes cvs.exe without going via bash.
On a Win9x machine you need to edit autoexec.bat using
Windows/system/Sysedit. You must reboot to make
the new settings take effect.
The following environment variables must be set:
PATHSystem
Add c:/bin and c:/usr/local/bin.
These should come before the Windows system directories
(e.g. \WINNT\system32). You might want to set them in
your .bashrc rather than in the system-wide
PATH.
SHELLUserc:/bin/sh.
HOMEUser
Set to point to your home directory. This is where, for example,
bash will look for your .bashrc
file.
MAKE_MODEUser
Set to UNIX. If you don't do
this you get very weird messages when you type `make', such as:
/c: /c: No such file or directoryTMPDIRUser
Set to c:/tmp. For some reason, Win2k invisibly sets this variable to point to a temporary directory in your profile, that contains embedded spaces. If GHC sees the TMPDIR variable set, it tries to use it for temporary files, but Cygwin doesn't grok filenames with spaces, so disaster results.
Furthermore, it seems that TMPDIR must be set to a directory in the same file system in which you invoke GHC. Otherwise you get very weird messages when you invoke GHC, such as:
does not exist
Action: openFile
Reason: file does not exist /tmp/ghc11068.cpp
We think this is due to a bug in Cygwin.
In addition, we've had problems in the past with certain environment
variables being set that seem to have bad effects on GHC. If you have
installed other systems ported from Unix, you might too. If you get weird
inexplicable failures to build GHC, then it might be worth weeding out unused
environment variables. Known culprits from the past include
GCC_EXEC_PREFIX and INCLUDE.
Perl5
The driver script is written in Perl, so you'll need to have this
installed too. However, the ghc binary distribution includes a
perl binary for you to make use of, should you not already have a
cygwin compatible one. Note: GHC does not
work with the ActiveState port of perl.
Installing GHC
Download a GHC distribution:
ghc-4.08—InstallShield installer, 15M: http
It is packaged up using an installer that should be familiar-looking to
Windows users.
Note: The cygwin support for long file names containing
spaces is not 100%, so make sure that you install ghc in a directory
that has no embedded spaces (i.e., resist the temptation to put it
in /Program Files/!)
When the installer has completed, make sure you add the location of the
ghc bin/ directory to your path (i.e.
/path/to/wherever/ghc-4.08/bin ).
You need to do this in order to bring the various GHC DLLs into scope;
if not, then you need to copy the DLLs into a directory that is (the
system directory, for example).
Note: If you haven't got perl already installed, you will have to manually
copy the perl.exe binary from the ghc
bin/ into your /bin directory
before continuing—the installer will not currently do this.
Make sure that you set all the environment variables described above
under Cygwin installation, including TMPDIR
To test the fruits of your labour, try now to compile a simple
Haskell program:
bash$ cat main.hs
module Main(main) where
main = putStrLn "Hello, world!"
bash$ /path/to/the/ghc/bin/directory/ghc-4.08 -o main main.hs
..
bash$ ./main
Hello, world!
bash$
OK, assuming that worked, you're all set. Go forth and write useful
Haskell programs :-) If not, consult the installation FAQ (); if that still doesn't help then please report the problems you're experiencing (see ).
Further information on using GHC under Windows can be found in Sigbjørn Finne's
pages. Note: ignore the installation instructions, which are rather
out of date; the Miscellaneous section at the bottom of
the page is of most interest, covering topics beyond the scope of this
manual. Installing ghc-win32 FAQ
Invoking ghc doesn't seem to do anything, it immediately returns without having compiled the input file.
One cause of this is that /bin/sh is missing. To
verify, open up a bash session and type ls -l
/bin/sh.exe. If sh.exe is reported as not
being there, copy bash.exe (which you'll find inside
the cygwin installation tree as bin/bash.exe) to
/bin/sh.exe.
All being well, ghc should then start to function.
I'm having trouble with symlinks.
Symlinks only work under Cygwin (), so binaries
not linked to the Cygwin DLL, in particular those built for Mingwin, will not
work with symlinks.
I'm getting ``permission denied'' messages from rm or
mv.
This can have various causes: trying to rename a directory when an Explorer
window is open on it tends to fail. Closing the window generally cures the
problem, but sometimes its cause is more mysterious, and logging off and back
on or rebooting may be the quickest cure.
I get errors when trying to build GHC 4.08 with GHC 4.05.
This seems to work better if you don't use
in GhcHcOpts. It's a bug in 4.05,
unfortunately. Anyway, better to install 4.08 binaries and use those.
Building the documentation
We use the DocBook DTD, which is widely used. Most shrink-wrapped distributions seem to be broken in one way or another; thanks to heroic efforts by Sven Panne and Manuel Chakravarty, we now support most of them, plus properly installed versions.
Instructions on installing and configuring the DocBook tools follow.
Installing the DocBook tools from RPMs If you're using a system that can handle RedHat RPM packages, you can
probably use the Cygnus DocBook
tools, which is the most shrink-wrapped SGML suite that we could
find. You need all the RPMs except for psgml (i.e.
docbook, jade,
jadetex, sgmlcommon and
stylesheets). Note that most of these RPMs are
architecture neutral, so are likely to be found in a
noarch directory. The SuSE RPMs also work; the RedHat
ones don't as of version 6.2, but they are easy to fix:
just make a symlink from
/usr/lib/sgml/stylesheets/nwalsh-modular/lib/dblib.dsl to
/usr/lib/sgml/lib/dblib.dsl. Installing from binaries on Windows
It's a good idea to use Norman Walsh's installation
notes as a guide. You should get version 3.1 of DocBook, and note
that his file test.sgm won't work, as it needs version
3.0. You should unpack Jade into \Jade, along with the
entities, DocBook into \docbook, and the DocBook
stylesheets into \docbook\stylesheets (so they actually
end up in \docbook\stylesheets\docbook).
Installing the DocBook tools from sourceJade
Install OpenJade (Windows binaries are available as well as sources). If you want DVI, PS, or PDF then install JadeTeX from the dsssl
subdirectory. (If you get the error:
! LaTeX Error: Unknown option implicit=false' for package hyperref'.
your version of hyperref is out of date; download it from
CTAN (macros/latex/contrib/supported/hyperref), and
make it, ensuring that you have first removed or renamed your old copy. If
you start getting file not found errors when making the test for
hyperref, you can abort at that point and proceed
straight to make install, or enter them as
../filename.)
Make links from virtex to jadetex
and pdfvirtex to pdfjadetex
(otherwise DVI, PostScript and PDF output will not work). Copy
dsssl/*.{dtd,dsl} and catalog to /usr/[local/]lib/sgml.
DocBook and the DocBook stylesheets
Get a Zip of DocBook
and install the contents in /usr/[local/]/lib/sgml.
Get the DocBook
stylesheets and install in
/usr/[local/]lib/sgml/stylesheets (thereby creating a
subdirectory docbook). For indexing, copy or link collateindex.pl from the DocBook stylesheets archive in bin into a directory on your PATH.
Download the ISO
entities into /usr/[local/]lib/sgml.
Configuring the DocBook tools
Once the DocBook tools are installed, the configure script will detect them and set up the build system accordingly. If you have a system that isn't supported, let us know, and we'll try to help.
Remaining problems
If you install from source, you'll get a pile of warnings of the form
DTDDECL catalog entries are not supported
every time you build anything. These can safely be ignored, but if you find them tedious you can get rid of them by removing all the DTDDECL entries from docbook.cat.