Changes between Version 57 and Version 58 of Building/Using


Ignore:
Timestamp:
Jul 20, 2011 9:33:57 AM (3 years ago)
Author:
simonmar
Comment:

instructions for freezing stage 1

Legend:

Unmodified
Added
Removed
Modified
  • Building/Using

    v57 v58  
    501501}}} 
    502502 
    503 Note that the first command above takes you to the {{{ghc}}} subdirectory of the source tree, not into the source tree (which is also named {{{ghc}}} if you did a {{{git clone}}}).  So if you did a {{{git clone}}} from your home directory, you'll be in {{{~/ghc/ghc/}}}, not {{{~/ghc/}}}.  Many of the compiler-building {{{make}}} invocations must be performed from this subdirectory, not from the root of the source tree. 
     503Note that the first command above takes you to the {{{ghc}}} subdirectory of the source tree, not into the source tree (which is also named {{{ghc}}} if you did a {{{git clone}}}).  So if you did a {{{git clone}}} from your home directory, you'll be in {{{~/ghc/ghc/}}}, not {{{~/ghc/}}}.  Many of the compiler-building {{{make}}} commands must be performed from this subdirectory, not from the root of the source tree. 
    504504 
    505505This will bring the stage 2 compiler up to date only.  Setting `stage=2` has the effect of disabling all the 
    506 rules that build the stage 1 compiler, so the build system will ignore the fact that the stage 1 compiler is also out of date, and hence all the libraries are also potentially out of date.  If you did `make` 
     506rules that build the stage 1 compiler, so the build system will ignore the fact that the stage 1 compiler is also out of date, and hence all the libraries are also potentially out of date.  If you just did `make` 
    507507from the top-level, all of these dependencies would be taken into 
    508508account, and a lot of rebuilding would probably ensue.  There's another target 
     
    521521Note that if you’ve never built stage3 before, you will need to create dependencies for it using `make stage=3`. This is because a normal build will skip building the stage3 compiler. You will then be able to run `make 3` as usual. 
    522522 
     523=== Freezing stage 1 === 
     524 
     525Often when working on GHC we find ourselves doing `make 2` a lot.  If we accidentally say `make` at some point, that will start building stage 1 (because presumably something in the GHC source code has changed), which has many knock-on effects: all the libraries will be reconfigured, rebuilt, and then stage 2 will be completely rebuilt.  To prevent this from happening, we can "freeze" stage 1 by adding a line to `mk/build.mk`: 
     526 
     527{{{ 
     528stage = 2 
     529}}} 
     530 
     531this prevents stage 1 from being rebuilt until this line is removed or commented-out again.  It's a handy trick when you're working on GHC. 
     532 
    523533=== Building a single file === 
    524534