X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fbuilding%2Fbuilding.xml;h=2b448fabaa0714535f6004e5085c70ec5b719485;hb=523d16b79ef458ee7a3c9d19896e08d36c2dcbb6;hp=5ea951b690382b34c0cb3325d7209ad675bd987d;hpb=003c2de9c159489d52ac220d7024e9a5d69e502b;p=ghc-hetmet.git
diff --git a/docs/building/building.xml b/docs/building/building.xml
index 5ea951b..2b448fa 100644
--- a/docs/building/building.xml
+++ b/docs/building/building.xml
@@ -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).
@@ -1445,8 +1444,8 @@ $ cvs checkout nofib/spectral
Quick StartIf 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 +2751,8 @@ directive.
- EXCLUDE_SRCS
- EXCLUDE_SRCS
+ EXCLUDED_SRCS
+ EXCLUDED_SRCSSet to a list of source files (relative to the
@@ -2771,7 +2770,7 @@ directive.
EXTRA_SRCS
- EXCLUDE_SRCS
+ EXTRA_SRCSSet to a list of extra source files (perhaps
@@ -2952,6 +2951,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 optionsPattern rules
@@ -3540,20 +3591,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:
@@ -3567,7 +3617,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).
@@ -3650,6 +3700,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
@@ -3689,7 +3746,7 @@ $ ./configure --enable-hc-boot --enable-hc-boot-unregisterised
$ cd T/ghc/includes
-$ make config.h
+$ make
@@ -3714,13 +3771,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
@@ -3746,20 +3806,19 @@ 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:
+$ touch H/ghc/includes/{ghcautoconf.h,DerivedConstants.h.GHCConstants.h.mkDerivedConstants.c,mkDerivedConstantsHdr,mkDerivedConstants.o,mkGHCConstants,mkGHCConstants.o}
@@ -3776,15 +3835,17 @@ $ 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
$ make clean
-$ make -k HC=H/ghc/compiler/stage1/ghc-inplace \
- EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files'
+$ 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'
@@ -4317,6 +4378,24 @@ Cygwin programs have a more complicated mount table, and map the lettered drives
+Crippled ld
+
+
+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
@@ -4424,7 +4503,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).
@@ -4695,7 +4778,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.
@@ -4708,7 +4791,13 @@ 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.
@@ -4727,6 +4816,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