X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fusers_guide%2Finstalling.sgml;h=e430ac15a8f8cab13e3804cbed71a1e1238f8099;hb=af76ab6142576b7cc4af11c4883c387e96b18f73;hp=7040cade646fa7073a7c217645bd9243c136d919;hpb=47aa57b8dbd23adbbd6a7e77a1ba0eaf59e48d5f;p=ghc-hetmet.git diff --git a/ghc/docs/users_guide/installing.sgml b/ghc/docs/users_guide/installing.sgml index 7040cad..e430ac1 100644 --- a/ghc/docs/users_guide/installing.sgml +++ b/ghc/docs/users_guide/installing.sgml @@ -1,25 +1,89 @@ -Installing from binary distributions + Installing GHC binary installations installation, 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-likes +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: + + + + Installing on Unix-a-likes (). + + + Installing on Windows (). + + + The layout of installed files (). You don't need to know this to + install GHC, but it's useful if you are changing the + implementation. + + + + Installing on Unix-a-likes + + + When a platform-specific package is available + + 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: + + + + RedHat or SuSE Linux/x86 + + RPM source & binary packages for RedHat and SuSE + Linux (x86 only) are available for most major + releases. + + + + + Debian Linux/x86 + + Debian packages for Linux (x86 only), also for most + major releases. + + + + + FreeBSD/x86 + + On FreeBSD/x86, GHC can be installed using either + the ports tree (cd /usr/ports/lang/ghc && make + install) or from a pre-compiled package + available from your local FreeBSD mirror. + + + + + Other platform-specific packages may be available, check + the GHC download page for details. + -Bundle structure +GHC binary distributions bundles of binary stuff @@ -27,7 +91,7 @@ proceed. For the other fptools programs, many are written in 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: +bundle-platform.tar.gz. (See the building guide for the definition of a platform.) Suppose that you untar a binary-distribution bundle, thus: @@ -39,8 +103,9 @@ Binary distributions come in “bundles,” one bundle per file called -Then you should find a single directory, fptools, with the following -structure: +Then you should find a single directory, +ghc-version, with the +following structure: @@ -95,7 +160,7 @@ Guide and this file isn't present. -bin/<platform> + bin/platform contains platform-specific executable @@ -104,7 +169,7 @@ must end up in your path. -lib/<platform>/ +lib/platform/ contains platform-specific support @@ -169,59 +234,18 @@ 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 +OK, so let's assume that you have unpacked your chosen bundles. What +next? Well, you will at least need to run the +configureconfigure +script by changing directory into the top-level directory for the +bundle and typing ./configure. That should convert Makefile.in to Makefile. @@ -236,11 +260,11 @@ 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. +follow. -To install an fptools package, you'll have to do the following: +To install a package, you'll have to do the following: @@ -379,11 +403,12 @@ regardless, ghc-x.xx should always invoke GHC version What bundles there are -bundles, 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: +bundles, 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: @@ -438,6 +463,12 @@ 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. + @@ -487,12 +518,8 @@ Some simple-but-profitable tests are to compile and run the notorious 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). - +For more information on how to “drive” GHC, read +on... @@ -503,281 +530,64 @@ with a binary distribution, or in source form in 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. - - -System requirements - - -An installation of GHC requires about 50M of disk space (which can be lowered by choosing a “compact” installation). The Cygwin support tools take another 200M or so (though if you really need to this can be halved by installing only the following packages: bash, binutils, cygwin, diff, fileutils, findutils, gcc, grep, make, perl, mingw, sed, textutils, w32api; however, it's fiddly and not recommended). 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.x) - - -At the moment you'll need Cygwin to use GHC. Cygwin dresses up the Win32 -environment into something more UNIX-like; (notably, it provides -gcc, as and ld). -You also need Cygwin to use CVS. - - - -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 the latest Cygwin 1.1.x from sources.redhat.com/cygwin. -If you have a pre-1.1 version, you should deinstall this first. Choose DOS -text mode. After installation, start up a Cygwin shell and issue the -following command: - - -mount -f c: / - -assuming you installed Cygwin at C:\cygwin; otherwise -change the drive and directory as appropriate. - - - - - -Create C:/Temp if it doesn't already exist; substitute -the drive you installed Cygwin on for C:). - - - - - -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 Panels -Double-click System -Press Advanced -Press Environment Variables -Under System Variables, select PATH -Press Edit -Add ";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: - - - - - - - - - - -PATH -System - -Add C:\usr\bin. -This should come before the Windows system directories -(e.g. \WINNT\system32). - - - - -SHELL -User - -C:/usr/bin/bash. - - - - -HOME -User - -Set to point to your home directory (normally under -C:/WINNT/Profiles on Win2k). This is where, for example, -bash will look for your .bashrc -file. - - - - -MAKE_MODE -User - -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 directory - - - -TMPDIR -User - -Set to C:/Temp. 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 /Temp/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. - - - - - - - -Installing GHC - - -Download the latest 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 (e.g. -/ghc/ghc-4.08/bin ). -You need to do this in order to bring the various GHC binaries into scope. - - - -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. - - - - + +Getting the Glasgow Haskell Compiler (post 5.02) to run on Windows platforms is +a snap: the Installshield does everything you need. + - +Installing GHC on Windows - -Make sure that you set all the environment variables described above -under Cygwin installation, including TMPDIR. - + +To install GHC, use the following steps: + + +Download the Installshield setup.exe +from the GHC download page +haskell.org. + + +Run setup.exe. +(If you have a previous version of GHC, Installshield will offer to "modify", +or "remove" GHC. Choose "remove"; then run setup.exe a +second time. This time it should offer to install.) + + +At this point you should find GHCi and the GHC documentation are +available in your Start menu under "Start/Programs/Glasgow Haskell Compiler". + + + + +The final dialogue box from the install process tells you where GHC has +been installed. If you want to invoke GHC from a command line, add this +to your PATH environment variable. Usually, GHC installs into +c:/ghc/ghc-5.02, though the last part of this path +depends on which version of GHC you are installing, of course. +You need to add c:/ghc/ghc-5.02/bin to your path if yo + + + +GHC needs a directory in which to create, and later delete, temporary files. +It uses the standard Windows procedure GetTempPath() to +find a suitable directory. This procedure returns: + +The path in environment variable TMP, +if TMP is set. +Otherwise, the path in environment variable TEMP, +if TEMP is set. +Otherwise, there is a per-user default which varies +between versions of Windows. On NT and XP-ish versions, it might +be: +c:\Documents and Settings\<username>\Local Settings\Temp + + +The main point is that if you don't do anything GHC will work fine; +but if you want to control where the directory is, you can do so by +setting TMP or TEMP. + + + To test the fruits of your labour, try now to compile a simple Haskell program: @@ -793,21 +603,36 @@ bash$ ghc -o main main.hs bash$ ./main Hello, world! bash$ + + + +You do not need the Cygwin toolchain, or anything +else, to install and run GHC. + -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 ). +An installation of GHC requires about 140M of disk space. +To run GHC comfortably, your machine should have at least +64M of memory. + - 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. - - - +Moving GHC around + +At the moment, GHC installs in a fixed place (c:/ghc/ghc-x.yy, +but once it is installed, you can freely move the entire GHC tree just by copying +the ghc-x.yy directory. (You may need to fix up +the links in "Start/Programs/Glasgow Haskell Compiler" if you do this.) + + +It is OK to put GHC tree in a directory whose path involves spaces. However, +don't do this if you use want to use GHC with the Cygwin tools, +because Cygwin can get confused when this happpens. +We havn't quite got to the bottom of this, but so far as we know it's not +a problem with GHC itself. Nevertheless, just to keep life simple we usually +put GHC in a place with a space-free path. + + Installing ghc-win32 FAQ @@ -835,7 +660,7 @@ work with symlinks. -I'm getting “permission denied” messages from rm or +I'm getting “permission denied” messages from the rm or mv. @@ -851,174 +676,193 @@ 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. - - - - - - - - -My programs compile fine but do nothing when run. - - - - Some recent versions of the mingw package in Cygwin seem to -cause this. mingwin version 20001111-1 works fine; you should be able to -select it by clicking on the version number of the mingw package in the list -presented by the Cygwin setup program. - - - - - - - - - - -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. - - + - -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. - +The layout of installed files - + +This section describes what files get installed where. You don't need to know it +if you are simply installing GHC, but it is vital information if you are changing +the implementation. + + GHC is installed in two directory trees: + + +Binary directory + known as $(bindir), holds executables that +the user is expected to invoke. Notably, +ghc and ghci. On Unix, this directory +is typically something like /usr/local/bin. On Windows, +however, this directory is always $(libdir)/bin. + + + + +Library directory, + known as $(libdir), holds all the +support files needed to run GHC. On Unix, this +directory is usually something like /usr/lib/ghc/ghc-5.02. + + + - + +When GHC runs, it must know where its library directory is. +It finds this out in one of two ways: + + + + +$(libdir) is passed to GHC using the flag. +On Unix (but not Windows), the installed ghc is just a one-line +shell script that invokes the real GHC, passing a suitable flag. +[All the user-supplied flags +follow, and a later flag overrides an earlier one, so a user-supplied +one wins.] + + + + On Windows (but not Unix), if no flag is given, GHC uses a system +call to find the directory in which the running GHC executable lives, and derives +$(libdir) from that. [Unix lacks such a system call.] + + + + + Layout of the library directory + +The layout of the library directory is almost identical on +Windows and Unix, as follows: layout: + + + $(libdir)/ + package.conf GHC package configuration + ghc-usage.txt Message displayed by ghc ––help + + bin/ [Win32 only] User-visible binaries + ghc.exe + ghci.bat + + unlit Remove literate markup + + touchy.exe [Win32 only] + perl.exe [Win32 only] + gcc.exe [Win32 only] + + ghc-x.xx GHC executable [Unix only] + + ghc-split Asm code splitter + ghc-asm Asm code mangler + + gcc-lib/ [Win32 only] Support files for gcc + specs gcc configuration + + cpp0.exe gcc support binaries + as.exe + ld.exe + + crt0.o Standard + ..etc.. binaries + + libmingw32.a Standard + ..etc.. libraries + + *.h Include files + + imports/ GHC interface files + std/*.hi 'std' library + lang/*.hi 'lang' library + ..etc.. + + include/ C header files + StgMacros.h GHC-specific + ..etc... header files + + mingw/*.h [Win32 only] Mingwin header files + + libHSrts.a GHC library archives + libHSstd.a + libHSlang.a + ..etc.. + + HSstd1.o GHC library linkables + HSstd2.o (used by ghci, which does + HSlang.o not grok .a files yet) + + +Note that: + + +On Win32, the $(libdir)/bin directory contains user-visible binaries; +add it to your PATH. The ghci executable is a .bat +file which invokes ghc. + +The GHC executable is the Real Thing (no intervening +shell scripts or .bat files). +Reason: we sometimes invoke GHC with very long command lines, +and cmd.exe (which executes .bat files) +truncates them. [We assume people won't invoke ghci with very long +command lines.] + +On Unix, the user-invokable ghc invokes $(libdir)/ghc-version, +passing a suitable flag. + + + + + $(libdir) also contains support + binaries. These are not expected to be + on the user's PATH, but and are invoked + directly by GHC. In the Makefile system, this directory is + also called $(libexecdir), but + you are not free to change it. It must + be the same as $(libdir). + + + +We distribute gcc with the Win32 distribution of GHC, so that users +don't need to install gcc, nor need to care about which version it is. +All gcc's support files are kept in $(libdir)/gcc-lib/. + + + + +Similarly, we distribute perl and a touch +replacement (touchy.exe) +with the Win32 distribution of GHC. + + + + The support programs ghc-split + and ghc-asm are Perl scripts. The + first line says #!/bin/perl; on Unix, the + script is indeed invoked as a shell script, which invokes + Perl; on Windows, GHC invokes + $(libdir)/perl.exe directly, which + treats the #!/bin/perl as a comment. + Reason: on Windows we want to invoke the Perl distributed + with GHC, rather than assume some installed one. + + + + + +