snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
208 stars 39 forks source link

Should Hadrian build ghctags and haddock in Stage1? #661

Closed snowleopard closed 5 years ago

snowleopard commented 5 years ago

The Make build system needs to build ghctags and haddock programs in Stage2. For example, see this commit: https://github.com/ghc/ghc/commit/5fb72555f7b7ab67a33583f33ad9160761ca434f.

However, #531 moved haddock to Stage1 and it worked fine. I couldn't find an explanation behind the move and reverted this change as part of the cleaning-up-after-531 issue #540. Let's discuss this here.

There is a Note [No stage2 packages when CrossCompiling or Stage1Only] in ghc.mk, which in particular says:

# Here's why:
#  - first of all, ghc-stage1 can't use stage0's ghc library (it's too old)
#  - neither do we register the ghc library (compiler/stage1) that we build
#    with stage0. TODO Why not? We do build it...
#  - as a result, we need to a) use ghc-stage2 to build packages that depend on
#    the ghc library (e.g. ghctags [4]) and b) exclude those packages when
#    ghc-stage2 is not available.

But in Hadrian we do register the ghc library built in Stage0, so presumably this means we could indeed now build all its dependants in Stage1.

Shall we move ghctags and haddock to Stage1? This simplifies the build system and also improves the performance, since we don't need to wait for Stage2 GHC to build these utilities.

mpickering commented 5 years ago

Seems like this should be done as it works and means some horrible logic can be removed from the build system.

snowleopard commented 5 years ago

Seems like this should be done as it works

@mpickering Yes, we know that it works, but is this the right thing to do? Why does the Make build system uses the Stage2 GHC to build Haddock?

snowleopard commented 5 years ago

Fixed here: https://gitlab.haskell.org/ghc/ghc/commit/6486c6e49c53e75f37ed732b38c5be7ae64785e8/pipelines?ref=master