X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=docs%2Fbuilding%2Fbuilding.xml;h=0375c38d0ba26127405c382138fdba1fb89f4bc3;hp=8547e81d75a9cc808a3ff0bb5ec6a9a4d2c5e036;hb=97850bacd6441d9459df0ff105434830f6451d62;hpb=69907617d58f6a97f7dc0b5e03b2fa0931ee686f diff --git a/docs/building/building.xml b/docs/building/building.xml index 8547e81..0375c38 100644 --- a/docs/building/building.xml +++ b/docs/building/building.xml @@ -135,7 +135,7 @@ Set your $CVSROOT environment variable to - :pserver:anoncvs@glass.cse.ogi.edu:/cvs + :pserver:anoncvs@cvs.haskell.org:/cvs If you set $CVSROOT in a shell script, be sure not to have any trailing spaces on that line, otherwise CVS will respond with a perplexing message like @@ -407,12 +407,12 @@ setsockopt IPTOS_THROUGHPUT: Invalid argument result in checking out the entire repository instead of just the fpconfig bit. $ cd directory -$ cvs checkout ghc hslibs libraries +$ cvs checkout ghc libraries The second command here checks out the relevant modules you want to work on. For a GHC build, for instance, you need at least the ghc, - hslibs and libraries + and libraries modules (for a full list of the projects available, see ). @@ -605,7 +605,7 @@ $ lndir source-tree $ cvs co -r ghc-4-06 fpconfig $ cd fptools -$ cvs co -r ghc-4-06 ghc hslibs +$ cvs co -r ghc-4-06 ghc libraries @@ -793,8 +793,7 @@ $ cvs checkout nofib/spectral hslibsproject - Supplemental libraries for GHC - (required for building GHC). + Old, now deprecated, libraries. Everything in here is in libraries. @@ -843,8 +842,8 @@ $ cvs checkout nofib/spectral So, to build GHC you need at least the - ghc, libraries and - hslibs projects (a GHC source distribution will + ghc and libraries + projects (a GHC source distribution will already include the bits you need). @@ -1221,8 +1220,9 @@ $ cvs checkout nofib/spectral Perl version 5 at least is required. GHC has been known to tickle bugs in Perl, so if you find that Perl crashes when running GHC try updating (or downgrading) your Perl - installation. Versions of Perl that we use and are known to - be fairly stable are 5.005 and 5.6.1. + installation. Versions of Perl before 5.6 have been known to have + various bugs tickled by GHC, so the configure script + will look for version 5.6 or later. For Win32 platforms, you should use the binary supplied in the InstallShield (copy it to @@ -1445,8 +1445,8 @@ $ cvs checkout nofib/spectral Quick Start If you are starting from a source distribution, and just - want a completely standard build, then the following should - work: + want a completely standard build, then the following procedure should + work (unless you're on Windows, in which case go to ). $ autoreconf $ ./configure @@ -2752,8 +2752,8 @@ directive. - EXCLUDE_SRCS - EXCLUDE_SRCS + EXCLUDED_SRCS + EXCLUDED_SRCS Set to a list of source files (relative to the @@ -2771,7 +2771,7 @@ directive. EXTRA_SRCS - EXCLUDE_SRCS + EXTRA_SRCS Set to a list of extra source files (perhaps @@ -2952,6 +2952,58 @@ directive. ones in boilerplate.mk. + + Platform settings + Platform settings + + + There are three platforms of interest when building GHC: + + + + The build platform + + The platform on which we are doing this build. + + + + + The host platform + + The platform on which these binaries will run. + + + + + The target platform + + The platform for which this compiler will generate code. + + + + + These platforms are set when running the + configure script, using the + , , and + options. The mk/config.mk + file defines several symbols related to the platform settings (see + mk/config.mk for details). + + We don't currently support build & host being different, because + the build process creates binaries that are both run during the build, + and also installed. + + If host and target are different, then we are building a + cross-compiler. For GHC, this means a compiler + which will generate intermediate .hc files to port to the target + architecture for bootstrapping. The libraries and stage 2 compiler + will be built as HC files for the target system (see for details. + + More details on when to use BUILD, HOST or TARGET can be found in + the comments in config.mk. + + Pattern rules and options Pattern rules @@ -3345,9 +3397,8 @@ directive. DocBook, pre-supposed - Much of our documentation is written in SGML, using - the DocBook DTD. Instructions on installing and - configuring the DocBook tools are below. + Much of our documentation is written in DocBook XML, instructions + on installing and configuring the DocBook tools are below. @@ -3387,27 +3438,21 @@ directive. Installing the DocBook tools on Linux - If you're on a recent RedHat system (7.0+), you probably - have working DocBook tools already installed. The configure - script should detect your setup and you're away. + If you're on a recent RedHat (7.0+) or SuSE (8.1+) system, + you probably have working DocBook tools already installed. The + configure script should detect your setup and you're away. If you don't have DocBook tools installed, and you are - 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 in RedHat 6.2 - (7.0 and later should be OK), 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. + using a system that can handle RPM packages, you can use Rpmfind.net to find suitable + packages for your system. Search for the packages + docbook-dtd, + docbook-xsl-stylesheets, + libxslt, + libxml2, + fop, + xmltex, and + dvips. @@ -3429,77 +3474,24 @@ $ make install 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). + Probably the fastest route to a working DocBook environment on + Windows is to install Cygwin + with the complete Doc category. If you are using + MinGW for compilation, you + have to help configure a little bit: Set the + environment variables XmllintCmd and + XsltprocCmd to the paths of the Cygwin executables + xmllint and xsltproc, + respectively, and set fp_cv_dir_docbook_xsl to the path + of the directory where the XSL stylesheets are installed, + e.g. c:/cygwin/usr/share/docbook-xsl. + + + If you want to build HTML Help, you have to install the + HTML Help SDK, + too, and make sure that hhc is in your PATH. - - - Installing the DocBook tools from source - - - Jade - - 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. - - @@ -3512,20 +3504,6 @@ $ make install - 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. - - - Building the documentation To build documentation in a certain format, you can @@ -3548,11 +3526,11 @@ $ make install Because there are many different formats that the DocBook documentation can be generated in, you have to select which ones - you want by setting the SGMLDocWays variable + you want by setting the XMLDocWays variable to a list of them. For example, in build.mk you might have a line: -SGMLDocWays = html ps +XMLDocWays = html ps This will cause the documentation to be built in the requested formats as part of the main build (the default is not to build @@ -3572,9 +3550,9 @@ $ make install documentation, which goes into $(datadir)/html, to keep things tidy. - Note that unless you set $(SGMLDocWays) + Note that unless you set $(XMLDocWays) to a list of formats, the install-docs target - won't do anything for SGML documentation. + won't do anything for DocBook XML documentation. @@ -3614,20 +3592,19 @@ $ make install Bootstrapping GHC on a system without GHC already installed is achieved by taking the intermediate C files (known - as HC files) from a GHC compilation on a supported system to the - target machine, and compiling them using gcc to get a working - GHC. + as HC files) from another GHC compilation, compiling them using gcc to + get a working GHC. NOTE: GHC versions 5.xx were hard to bootstrap from C. We recommend using GHC 6.0.1 or later. HC files are platform-dependent, so you have to get a set - that were generated on similar hardware. There may be some - supplied on the GHC download page, otherwise you'll have to - compile some up yourself, or start from - unregisterised HC files - see . + that were generated on the same platform. There + may be some supplied on the GHC download page, otherwise you'll have to + compile some up yourself, or start from + unregisterised HC files - see . The following steps should result in a working GHC build with full libraries: @@ -3641,7 +3618,7 @@ $ make install corresponding Haskell source (.hs or .lhs) in the compiler subdirectory ghc/compiler and in the libraries - (subdirectories of hslibs and + (subdirectories of libraries). @@ -3724,6 +3701,13 @@ $ make install Cross-compiling to produce an unregisterised GHC + NOTE! These instructions apply to GHC 6.4 and (hopefully) + later. If you need instructions for an earlier version of GHC, try + to get hold of the version of this document that was current at the + time. It should be available from the appropriate download page on + the GHC homepage. + In this section, we explain how to bootstrap GHC on a new platform, using unregisterised intermediate C files. We haven't put a great deal of effort into automating this @@ -3763,7 +3747,7 @@ $ ./configure --enable-hc-boot --enable-hc-boot-unregisterised $ cd T/ghc/includes -$ make config.h +$ make @@ -3788,13 +3772,16 @@ $ ./configure with the following contents: GhcUnregisterised = YES -GhcLibHcOpts = -O -H32m -keep-hc-files +GhcLibHcOpts = -O -fvia-C -keep-hc-files +GhcRtsHcOpts = -keep-hc-files GhcLibWays = SplitObjs = NO GhcWithNativeCodeGen = NO GhcWithInterpreter = NO -GhcStage1HcOpts = -O -H32m -fasm -GhcStage2HcOpts = -O -fvia-C -keep-hc-files +GhcStage1HcOpts = -O +GhcStage2HcOpts = -O -fvia-C -keep-hc-files +SRC_HC_OPTS += -H32m +GhcBootLibs = YES @@ -3820,20 +3807,31 @@ GhcStage2HcOpts = -O -fvia-C -keep-hc-files Copy - T/ghc/includes/config.h + T/ghc/includes/ghcautoconf.h, T/ghc/includes/DerivedConstants.h, and T/ghc/includes/GHCConstants.h to H/ghc/includes. Note that we are building on the host machine, using the - target machine's config.h file. This + target machine's configuration files. This is so that the intermediate C files generated here will be suitable for compiling on the target system. - - Touch config.h, just to make - sure it doesn't get replaced during the build: -$ touch H/ghc/includes/config.h + Touch the generated configuration files, just to make + sure they don't get replaced during the build: +$ cd H/ghc/includes +$ touch ghcautoconf.h DerivedConstants.h GHCConstants.h mkDerivedConstants.c +$ touch mkDerivedConstantsHdr mkDerivedConstants.o mkGHCConstants mkGHCConstants.o + + Note: it has been reported that these files still get + overwritten during the next stage. We have installed a fix + for this in GHC 6.4.2, but if you are building a version + before that you need to watch out for these files getting + overwritte by the Makefile in + ghc/includes. If your system supports + it, you might be able to prevent it by making them + immutable: +$ chflags uchg ghc/includes/{ghcautoconf.h,DerivedConstants.h,GHCConstants.h} @@ -3850,15 +3848,19 @@ $ make boot && make -$ cd H/ghc +$ cd H/ghc/compiler $ make boot stage=2 && make stage=2 - + -$ cd H/ghc/utils +$ cd H/ghc/lib/compat $ make clean -$ make -k HC=H/ghc/compiler/stage1/ghc-inplace \ - EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files' +$ rm .depend +$ make boot UseStage1=YES +$ make -k UseStage1=YES EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files' +$ cd H/ghc/utils +$ make clean +$ make -k UseStage1=YES EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files' @@ -4391,6 +4393,24 @@ Cygwin programs have a more complicated mount table, and map the lettered drives +Crippled <command>ld</command> + + +It turns out that on both Cygwin and MSYS, the ld has a +limit of 32kbytes on its command line. Especially when using split object +files, the make system can emit calls to ld with thousands +of files on it. Then you may see something like this: + +(cd Graphics/Rendering/OpenGL/GL/QueryUtils_split && /mingw/bin/ld -r -x -o ../QueryUtils.o *.o) +/bin/sh: /mingw/bin/ld: Invalid argument + +The solution is either to switch off object file splitting (set + to NO in your +build.mk), +or to make the module smaller. + + + Host System vs Target System @@ -4498,7 +4518,11 @@ Run both executables (in the order given above) to install them. I put them in Set the following environment variables - PATH: add c:/msys/1.0/bin to your path. (Of course, the version number may differ.) + PATH: add c:/msys/1.0/bin and + c:/msys/1.0/local/bin + to your path. (Of course, the version number may differ.) + MSYS mounts the former as both /bin and + /usr/bin and the latter as /usr/local/bin. HOME: set to your home directory (e.g. c:/userid). @@ -4556,11 +4580,17 @@ bzip'd dump. -Installing and configuring Cygwin +Installing and configuring Cygwin Install Cygwin from http://www.cygwin.com/. -The installation process is straightforward; we install it in c:/cygwin. -During the installation dialogue, make sure that you select all of the following: +The installation process is straightforward; we install it in +c:/cygwin. + +You must install enough Cygwin packages to support +building GHC. If you miss out any of these, strange things will happen to you. There are two ways to do this: + +The direct, but laborious way is to +select all of the following packages in the installation dialogue: cvs, openssh, autoconf, @@ -4568,11 +4598,32 @@ During the installation dialogue, make sure that you select all of the following gcc, flex, make. -If you miss out any of these, strange things will happen to you. To see thse packages, +To see thse packages, click on the "View" button in the "Select Packages" stage of Cygwin's installation dialogue, until the view says "Full". The default view, which is "Category" isn't very helpful, and the "View" button is rather unobtrousive. + + +The clever way is to point the Cygwin installer at the +ghc-depends package, which is kept at http://haskell.org/ghc/cygwin. +When the Cygwin installer asks you to "Choose a Download Site", choose one of +the +offered mirror sites; and then type "http://haskell.org/ghc/cygwin" into the +"User URL" box and click "Add"; now two sites are selected. (The Cygwin +installer remembers this for next time.) +Click "Next". +In the "Select Packages" dialogue box that follows, click the "+" sign by +"Devel", scroll down to the end of the "Devel" packages, and choose +ghc-depends. +The package ghc-depends will not actually install anything itself, +but forces additional packages to be added by the Cygwin installer. + + + + + Now set the following user environment variables: @@ -4601,50 +4652,7 @@ file. Ditto emacs looking for .emacsrc - -There are a few other things to do: - - - -By default, cygwin provides the command shell ash -as sh.exe. We have often seen build-system problems that -turn out to be due to bugs in ash -(to do with quoting -and length of command lines). On the other hand bash seems -to be rock solid. -So, in cygwin/bin -remove the supplied sh.exe (or rename it as ash.exe), -and copy bash.exe to sh.exe. -You'll need to do this in Windows Explorer or the Windows cmd shell, because -you can't rename a running program! - - - - - -Some script files used in the make system start with "#!/bin/perl", -(and similarly for sh). Notice the hardwired path! -So you need to ensure that your /bin directory has the following -binaries in it: - - sh - perl - cat - -All these come in Cygwin's bin directory, which you probably have -installed as c:/cygwin/bin. By default Cygwin mounts "/" as -c:/cygwin, so if you just take the defaults it'll all work ok. -(You can discover where your Cygwin -root directory / is by typing mount.) -Provided /bin points to the Cygwin bin -directory, there's no need to copy anything. If not, copy these binaries from the cygwin/bin -directory (after fixing the sh.exe stuff mentioned in the previous bullet). - - - - - -Finally, here are some things to be aware of when using Cygwin: +Here are some things to be aware of when using Cygwin: Cygwin doesn't deal well with filenames that include spaces. "Program Files" and "Local files" are @@ -4663,6 +4671,38 @@ they don't recognise symlinks. See the notes in about find and bzip, which apply to Cygwin too. + + + +Some script files used in the make system start with "#!/bin/perl", +(and similarly for sh). Notice the hardwired path! +So you need to ensure that your /bin directory has at least +sh, perl, and cat in it. +All these come in Cygwin's bin directory, which you probably have +installed as c:/cygwin/bin. By default Cygwin mounts "/" as +c:/cygwin, so if you just take the defaults it'll all work ok. +(You can discover where your Cygwin +root directory / is by typing mount.) +Provided /bin points to the Cygwin bin +directory, there's no need to copy anything. If not, copy these binaries from the cygwin/bin +directory (after fixing the sh.exe stuff mentioned in the previous bullet). + + + + + +By default, cygwin provides the command shell ash +as sh.exe. It seems to be fine now, but in the past we +saw build-system problems that turned out to be due to bugs in ash +(to do with quoting and length of command lines). On the other hand bash seems +to be rock solid. +If this happens to you (which it shouldn't), in cygwin/bin +remove the supplied sh.exe (or rename it as ash.exe), +and copy bash.exe to sh.exe. +You'll need to do this in Windows Explorer or the Windows cmd shell, because +you can't rename a running program! + + @@ -4671,9 +4711,10 @@ which apply to Cygwin too. Configuring SSH -ssh comes with Cygwin, provided you remember to ask for it when -you install Cygwin. (If not, the installer lets you update easily.) Look for openssh -(not ssh) in the Cygwin list of applications! +ssh comes with both Cygwin and MSYS. +(Cygwin note: you need to ask for package openssh (not ssh) +in the Cygwin list of packages; or use the ghc-depends +package -- see .) There are several strange things about ssh on Windows that you need to know. @@ -4769,7 +4810,7 @@ Make sure the installation directory is in your - Install Alex. This can be done by building from the + Install an executable Alex. This can be done by building from the source distribution in the same way as Happy. Sources are available from http://www.haskell.org/alex. @@ -4782,10 +4823,20 @@ Just pick up a mingw bundle at http://www.mingw.org/. We install it in c:/mingw. -Do not add any of the mingw binaries to your path. + +On MSYS, add c:/mingw/bin to your PATH. MSYS does not provide gcc, +ld, ar, and so on, because it just uses the MinGW ones. So you need them +in your path. + + +On Cygwin, do not add any of the mingw binaries to your path. They are only going to get used by explicit access (via the --with-gcc flag you give to configure later). If you do add them to your path -you are likely to get into a mess because their names overlap with Cygwin binaries. +you are likely to get into a mess because their names overlap with Cygwin +binaries. +On the other hand, you do need ld, ar +(and perhaps one or two other things) in your path. The Cygwin ones are fine, +but you must have them; hence needing the Cygwin binutils package. @@ -4801,6 +4852,11 @@ so you will need to add emacs/bin to your PATH + + You might want to install GLUT in your MSYS/Cygwin + installation, otherwise the GLUT package will not be built with + GHC. + Finally, check out a copy of GHC sources from @@ -4906,6 +4962,90 @@ Win32. +A Windows build log using Cygwin + +Here is a complete, from-scratch, log of all you need to build GHC using +Cygwin, kindly provided by Claus Reinke. It does not discuss alternative +choices, but it gives a single path that works. +- Install some editor (vim, emacs, whatever) + +- Install cygwin (http://www.cygwin.com) + ; i used 1.5.16-1, installed in c:\cygwin + - run 'setup.exe' + Choose a Download Source: + select 'download from internet'; + Select Root Install Directory: + root dir: c:\cygwin; + install for: all users; + default file type: unix + Select Local Package Directory + choose a spare temporary home + Select Your Internet Connection + Use IE5 settings + Choose a Download Site + Choose your preferred main mirror and + Add 'http://www.haskell.org/ghc/cygwin' + Select Packages + In addition to 'Base' (default install), + select 'Devel->ghc-depends' + +- Install mingw (http://www.mingw.org/) + ; i used MinGW-3.1.0-1.exe + ; installed in c:\mingw + - you probably want to add GLUT + ; (http://www.xmission.com/~nate/glut.html) + ; i used glut-3.7.3-mingw32.tar + +- Get recent binary snapshot of ghc-6.4.1 for mingw + ; (http://www.haskell.org/ghc/dist/stable/dist/) + - unpack in c:/ghc + - add C:\ghc\ghc-6.4.1\bin to %PATH% + (Start->Control Panel->System->Advanced->Environment Variables) + +- Get cvs version of ghc + ; also, subscribe to cvs-all@haskell.org, or follow the mailing list + ; archive, in case you checkout a version with problems + ; http://www.haskell.org//pipermail/cvs-all/ + - mkdir c:/fptools; cd c:/fptools + ; (or whereever you want your cvs tree to be) + - export CVSROOT=:pserver:anoncvs@cvs.haskell.org:/cvs + - cvs login + ; pw: cvs + - cvs checkout fpconfig + - cd fptools + - cvs checkout ghc hslibs libraries + +- Build ghc, using cygwin and mingw, targetting mingw + - export PATH=/cygdrive/c/ghc/ghc-6.4.1:$PATH + ; for haddock, alex, happy (*) + - export PATH=/cygdrive/c/mingw/bin:$PATH + ; without, we pick up some cygwin tools at best! + - cd c:/fptools/fptools + ; (if you aren't there already) + - autoreconf + - ./configure --host=i386-unknown-mingw32 --with-gcc=C:/Mingw/bin/gcc.exe + ; we use cygwin, but build for windows + - cp mk/build.mk.sample mk/build.mk + - in mk/build.mk: + add line: SplitObjs = NO + (MSYS seems slow when there are zillions of object files) + uncomment line: BuildFlavour = perf + (or BuildFlavour = devel, if you are doing development) + add line: BIN_DIST=1 + - make 2>&1 | tee make.log + ; always useful to have a log around + +- Package up binary distribution + - make binary-dist Project=Ghc 2>&1 | tee make-bin-dist.log + ; always useful to have a log around + - cd ghc-6.5 + - chmod +x ../distrib/prep-bin-dist-mingw + ; if you're happy with the script's contents (*) + - ../distrib/prep-bin-dist-mingw + ; then tar up, unpack where wanted, and enjoy + + +