Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Should Hadrian build ghctags and haddock in Stage1? #661

Closed
snowleopard opened this issue Aug 27, 2018 · 3 comments
Closed

Should Hadrian build ghctags and haddock in Stage1? #661

snowleopard opened this issue Aug 27, 2018 · 3 comments

Comments

@snowleopard
Copy link
Owner

snowleopard commented Aug 27, 2018

The Make build system needs to build ghctags and haddock programs in Stage2. For example, see this commit: ghc/ghc@5fb7255.

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.

@snowleopard snowleopard changed the title Can Hadrian build ghctags and haddock in Stage1? Should Hadrian build ghctags and haddock in Stage1? Aug 27, 2018
@mpickering
Copy link
Contributor

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

@snowleopard
Copy link
Owner Author

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?

bgamari pushed a commit to ghc/ghc that referenced this issue Jan 9, 2019
This ticket enables the building of a `stage3` compiler by making the
build logic more consistent and predictable in Hadrian.

Two of the main changes are:

1. In order to build anything at stageN we use the package database
present at stageN. Fixing #16069
2. `haddock` and `ghc-tags` are built
as stage1 executables (with the stage1 compiler) rather than as
stage2 compiler. Fixing
[hadrian#661](snowleopard/hadrian#661)

In order to build a stage3 compiler, you have to set the new `finalStage` hadrian option to `Stage3`.
@snowleopard
Copy link
Owner Author

nineonine pushed a commit to nineonine/ghc that referenced this issue Jan 26, 2019
This ticket enables the building of a `stage3` compiler by making the
build logic more consistent and predictable in Hadrian.

Two of the main changes are:

1. In order to build anything at stageN we use the package database
present at stageN. Fixing #16069
2. `haddock` and `ghc-tags` are built
as stage1 executables (with the stage1 compiler) rather than as
stage2 compiler. Fixing
[hadrian#661](snowleopard/hadrian#661)

In order to build a stage3 compiler, you have to set the new `finalStage` hadrian option to `Stage3`.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants