Changes between Version 44 and Version 45 of Building/Prerequisites

Apr 1, 2009 10:00:09 AM (9 years ago)



  • Building/Prerequisites

    v44 v45  
    3 = Installing the tools you need to build GHC =
    5 This page describes how to set up your system with all the tools you need to build, and develop, GHC.  Jump to the relevant section for your operating system:
    7  * [#PreparingaLinuxsystem Linux]
    8  * [#PreparingaWindowssystem Windows]
    9  * [#PreparingaMacOSXsystem MacOS X]
    10  * [#PreparingaSolarissystem Solaris]
    12 [#Details Details] are available below on the software prerequisites.
    14 == Preparing a Linux system ==
    16 If you're on a recent Linux system, then you should be able to get a working build environment by installing the following packages using your system's package manager:
    18  * glibc-devel
    19  * libedit-devel
    20  * ncurses-devel
    21  * gmp-devel
    22  * autoconf
    23  * automake
    24  * libtool
    25  * gcc
    26  * make
    27  * perl
    28  * python (only needed for the testsuite)
    29  * ghc (recent stable version of ghc, not a development version)
    30  * happy
    31  * alex
    33 To be able to build the documentation (User's Guide and Cabal guide):
    35  * docbook-utils
    36  * docbook-utils-pdf
    37  * docbook-style-xsl
    39 other packages that are useful for development:
    41  * strace
    42  * patch
    43  * libcurl-devel and zlib-devel (for building darcs)
    45 == Preparing a Windows system ==
    47 Installing the following will get you a working build environment with MSYS (alternatively, [wiki:Building/Windows/Cygwin install Cygwin]).  For your convenience we've cached a working set of build tools that you can download.  Note: do not install anything in a directory that contains spaces, because the GHC build system is not capable of handling paths with spaces in.
    49  * First install a recent stable version of [ GHC].
    51  * Install MinGW: [].  When the installer asks you which version to install, choose "Current".
    53  * The `windres` program that comes with MinGW isn't compatible with GHC.  Download a later version: [] and put it in `c:/mingw/bin` (or wherever you installed MinGW).
    55  * Install MSYS:
    56    * []
    57    * []
    58    * [] (this is a tar file, which you have to unpack in `c:/msys/1.0`, or wherever you installed MSYS.  Note that you can't do that using an MSYS shell, because you can't overwrite the files in use, so make a copy of `c:/msys/1.0`, unpack it there, and then rename the copy back to `c:/msys/1.0`).
    60  * Install [ Python] (version 2.5.x or 2.6.x, NOT 3.x).
    62 The next three are just zip files, you can unpack them wherever you like, but you need to ensure that the programs can be found on your `PATH`.  I usually put all these in `c:/tools` (NB. don't put them anywhere in `c:/msys`, that's special).
    64  * Install Happy: []
    65  * Install Alex: []
    66  * Install Haddock: []
    68 Now set your `PATH`.  We recommend doing this by creating a file `.profile` in your home directory (by default `c:/msys/1.0/home/<username>`).  The contents of your `.profile` should be something like this:
    70 {{{
    71 PATH=/c/mingw/bin:/c/ghc/ghc-6.10.1/bin:/usr/bin:/bin:/c/tools:/c/Python26:/c/windows/system32
    72 }}}
    74 Modify the above according to where you installed things, and change the GHC version appropriately.
    76 === Building documentation on Windows ===
    78 Documentation is optional, but in order to build it in Windows you must currently use Cygwin (there isn't a working DocBook toolchain on MSYS as far as we know).
    80 In the Cygwin installer, just install the complete {{{Doc}}} category. You
    81 may have to help {{{configure}}} a little bit: Set the
    82 environment variables {{{XmllintCmd}}} and
    83 {{{XsltprocCmd}}} to the paths of the Cygwin executables
    84 {{{xmllint}}} and {{{xsltproc}}},
    85 respectively, and set {{{fp_cv_dir_docbook_xsl}}} to the path
    86 of the directory where the XSL stylesheets are installed,
    87 e.g. {{{c:/cygwin/usr/share/docbook-xsl}}}.   
    89 If you want to build HTML Help, you have to install the
    90 [ HTML Help SDK],
    91 too, and make sure that {{{hhc}}} is in your {{{PATH}}}.
    93 == Preparing a MacOS X system ==
    95 See [wiki:Building/MacOSX].  !ToDo: move the relevant parts of the docs here.
    97 == Preparing a Solaris system ==
    99 See [wiki:Building/Solaris].  !ToDo: move the relevant parts of the docs here.
    101 = Details =
    103 Here are the gory details about which programs and tools you need in order to build GHC.
    104 In most cases the `configure` script will tell you if you are missing something.
    106  GHC::
    107   GHC is required to build GHC, because GHC itself is
    108   written in Haskell, and uses GHC extensions.  It is possible
    109   to build GHC using just a C compiler, and indeed some
    110   distributions of GHC do just that, but it isn't the best
    111   supported method, and you may encounter difficulties.  Full
    112   instructions are in [wiki:Building/Porting Porting GHC].
    113   [[br]][[br]]
    114   GHC can be built using either an earlier released
    115   version of GHC (currently 6.6 and later are supported), or
    116   bootstrapped using a GHC built from exactly the same
    117   sources.  Note that this means you cannot in general build
    118   GHC using an arbitrary development snapshot, or a build from
    119   say last week.  It might work, it might not - we don't
    120   guarantee anything.  To be on the safe side, start your
    121   build using the most recently released stable version of
    122   GHC.
    123   [[br]][[br]]
    124   In general, we support building with the previous 2
    125   major releases, so:
    126   * To build 6.8.* you need GHC >= 6.4
    127   * To build 6.10.* you need GHC >= 6.6
    129  Perl::
    130   Perl version 5 at least is required.  GHC has been known to
    131   tickle bugs in Perl, so if you find that Perl crashes when
    132   running GHC try updating (or downgrading) your Perl
    133   installation.  Versions of Perl before 5.6 have been known to have
    134   various bugs tickled by GHC, so the configure script
    135   will look for version 5.6 or later.
    137   Perl should be put somewhere so that it can be invoked
    138   by the {{{#!}}} script-invoking mechanism.
    140  GNU C ({{{gcc}}})::
    141   Most GCC versions should work with the most recent GHC
    142   sources.  Expect trouble if you use a recent GCC with
    143   an older GHC, though (trouble in the form of mis-compiled code,
    144   link errors, and errors from the {{{ghc-asm}}}
    145   script).
    146   [[br]][[br]]
    147   If your GCC dies with "internal error"" on
    148   some GHC source file, please let us know, so we can report
    149   it and get things improved.  (Exception: on x86
    150   boxes, you may need to fiddle with GHC's
    151   {{{-monly-N-regs}}} option; see the User's
    152   Guide).
    154  GNU Make::
    155   The GHC build system makes heavy use of features
    156   specific to recent versions of GNU {{{make}}}, so
    157   you must have at least GNU make 3.80 installed in
    158   order to build GHC.
    160  [ Happy]::
    161   Happy is a parser generator tool for Haskell, and is
    162   used to generate GHC's parsers.
    163   [[br]][[br]]
    164   If you start from a source tarball of GHC (i.e. not a darcs
    165   checkout), then you don't need Happy, because we supply the
    166   pre-processed versions of the Happy parsers.  If you intend to
    167   modify the compiler and/or you're using a darcs checkout, then you
    168   need Happy.
    169   [[br]][[br]]
    170   Happy version 1.15 is currently required to build GHC.
    171   Grab a copy from
    172   [ Happy's Web Page].
    174  [ Alex]::
    175   Alex is a lexical-analyser generator for Haskell,
    176   which GHC uses to generate its lexer.
    177   [[br]][[br]]
    178   Like Happy, you don't need Alex if you're building GHC from a
    179   source tarball, but you do need it if you're modifying GHC and/or
    180   building a darcs checkout.
    181   [[br]][[br]]
    182   Alex is
    183   written in Haskell and is a project in the darcs repository.
    184   Alex distributions are available from
    185   [ Alex's Web Page].
    187  [ Haddock]::
    188   Haddock is a documentation generator for Haskell,
    189   used for making the docs for the libraries. If you don't want to build the docs then you don't need haddock.
    190   [[br]][[br]]
    191   Haddock is only needed for GHC 6.8.3 and older; GHC 6.10 comes with Haddock. 
    192   For GHC 6.8 and older you need a 0.* version of haddock; 2.* versions won't work.
    194  {{{autoconf}}} and {{{automake}}}::
    195   These are needed if you intend to build from the
    196   darcs sources, they are ''not'' needed if you
    197   just intend to build a standard source distribution.
    198   [[br]][[br]]
    199   Version 2.52 or later of the autoconf package is required.
    200   NB. version 2.13 will no longer work, as of GHC version
    201   6.1.  Version 1.9 of automake is known to work, use others at
    202   your own risk.
    203   [[br]][[br]]
    204   {{{autoreconf}}} (from the autoconf package)
    205   recursively builds {{{configure}}} scripts from
    206   the corresponding {{{}}} and
    207   {{{aclocal.m4}}} files.  If you modify one of
    208   the latter files, you'll need {{{autoreconf}}} to
    209   rebuild the corresponding {{{configure}}}.
    211  {{{sed}}}::
    212   Most Unix installations and Cygwin/MSYS on
    213   Windows already come with `sed`, so you're probably OK.
    214   GNU sed version 2.0.4 is no good!  It has a bug
    215   in it that is tickled by the build-configuration.  2.0.5 is
    216   OK. Others are probably OK too (assuming we don't create too
    217   elaborate configure scripts.)
    219  {{{diff}}}::
    220   Most installations should have this by default, but inexplicably
    221   Cygwin does not bundle it by default.
    223  Python::
    224   Required for [wiki:Building/RunningTests running the testsuite].
    225   Version 2.5.2 or later is preferred, because you'll get support for
    226   running the testsuite in parallel.  Stay away from 3.0 and later for now.
    228  [ libedit]::
    229   If libedit is installed, ghci will be built with a nice interactive line-editing interface. 
    230   Version 2.6.9 and later are known to work; note that the libeditline package listed on some distros is too old.
    231   If a suitable version of libedit cannot be found, ghc/ghci will still build fine, just without the nice line-editing capabilities.
    232   [[br]][[br]] If your installation does not have libedit by default, you may either download and build it yourself from the link above, or else install your distro's relevant package (sometimes called "libedit-devel" or "libedit-dev").
    233  [[br]][[br]]GHC does not use libedit on Windows; instead, it uses the console's default line editor.
     1This page has moved to [wiki:Building/Preparation].  Please update links.