Build error if booter is unregisterised
Summary
If booter/stage0 compiler is unregisterised, then building a registerised compiler fails in all my experiments except in one case. The tests were done on x64 with 8.10.7 as booter and 9.2.3 as target:
Booter | Target | Result
------------+-----------+---------
8.10.7+U+H | 9.2.3+R+H | Ok
8.10.7+U+H | 9.2.3+R+M | Fail (*)
8.10.7+U+M | 9.2.3+R+M | Fail (*)
8.10.7+U+M | 9.2.3+R+H | Fail (#)
8.10.7+R+M | 9.2.3+R+H | Ok
U = Unregisterised
R = Registerised
H = Hadrian
M = Make
The only working combination I found so far, if the booter is unregisterised, is to use Hadrian in order to build the booter as well as the target compiler. As a sanity check I also gave a registerised booter a chance where I didn't run into any problems.
Target build error messages
(*)
chmod +x inplace/bin/ghc-stage2
"inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O0 -H64m -Wall -hide-all-packages -package-env - -i -iutils/check-ppr/. -iutils/check-ppr/dist-install/build -Iutils/check-ppr/dist-install/build -iutils/check-ppr/dist-install/build/check-ppr/autogen -Iutils/check-ppr/dist-install/build/check-ppr/autogen -optP-include -optPutils/check-ppr/dist-install/build/check-ppr/autogen/cabal_macros.h -package-id Cabal-3.6.3.0 -package-id base-4.16.2.0 -package-id bytestring-0.11.3.1 -package-id containers-0.6.5.1 -package-id directory-1.3.6.2 -package-id filepath-1.4.2.2 -package-id ghc-9.2.3 -Wall -XHaskell2010 -no-user-package-db -rtsopts -Wnoncanonical-monad-instances -outputdir utils/check-ppr/dist-install/build -c utils/check-ppr/./Main.hs -o utils/check-ppr/dist-install/build/Main.dyn_o "inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O0 -H64m -Wall -hide-all-packages -package-env - -i -iutils/check-exact/. -iutils/check-exact/dist-install/build -Iutils/check-exact/dist-install/build -iutils/check-exact/dist-install/build/check-exact/autogen -Iutils/check-exact/dist-install/build/check-exact/autogen -optP-include -optPutils/check-exact/dist-install/build/check-exact/autogen/cabal_macros.h -package-id Cabal-3.6.3.0 -package-id base-4.16.2.0 -package-id bytestring-0.11.3.1 -package-id containers-0.6.5.1 -package-id directory-1.3.6.2 -package-id filepath-1.4.2.2 -package-id ghc-9.2.3 -package-id ghc-boot-9.2.3 -package-id mtl-2.2.2 -Wall -XHaskell2010 -no-user-package-db -rtsopts -Wnoncanonical-monad-instances -outputdir utils/check-exact/dist-install/build -c utils/check-exact/./Types.hs -o utils/check-exact/dist-install/build/Types.dyn_o
make[1]: *** [utils/check-exact/ghc.mk:18: utils/check-exact/dist-install/build/Types.dyn_o] Segmentation fault (core dumped)
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [utils/check-ppr/ghc.mk:18: utils/check-ppr/dist-install/build/Main.dyn_o] Segmentation fault (core dumped)
make: *** [Makefile:128: all] Error 2
(#)
/--------------------------------------------------------\
| Successfully built library 'ghc' (Stage0, way v). |
| Library: _build/stage0/compiler/build/libHSghc-9.2.3.a |
| Library synopsis: The GHC API. |
\--------------------------------------------------------/
| Copy package 'ghc'
# cabal-copy (for _build/stage0/lib/package.conf.d/ghc-9.2.3.conf)
| Register package 'ghc'
# cabal-register (for _build/stage0/lib/package.conf.d/ghc-9.2.3.conf)
| Configure package 'ghc-bin'
| Configure package 'haddock'
# cabal-configure (for _build/stage0/ghc/setup-config)
# cabal-configure (for _build/stage0/utils/haddock/setup-config)
hadrian: Encountered missing or private dependencies:
xhtml ==3000.2.*
Error when running Shake build system:
at action, called at src/Rules.hs:40:19 in main:Rules
at need, called at src/Rules.hs:62:5 in main:Rules
* Depends on: _build/stage0/bin/haddock
at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shake-0.19.6-576ad0fced9c674bfff23772afdeb780c35f77d3ce7941f4ce60ae5ec1ea8de6:Development.Shake.Internal.Rules.Oracle
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage0, package = Package {pkgType = Program, pkgName = "haddock", pkgPath = "utils/haddock"}, way = v}))
at need, called at src/Hadrian/Oracles/Cabal/Rules.hs:54:9 in main:Hadrian.Oracles.Cabal.Rules
* Depends on: _build/stage0/utils/haddock/setup-config
* Raised the exception:
ExitFailure 1
Steps to reproduce
FROM fedora:36
RUN dnf -y upgrade \
&& dnf -y install alex autoconf automake cabal-install llvm12 gcc gcc-g++ make ghc git file findutils happy which python3 xz diffutils
RUN cabal update \
&& cabal install happy --constraint='happy ^>=1.19' --program-suffix=-1.19
RUN git clone --depth 1 --branch ghc-8.10.7-release --recurse-submodules https://gitlab.haskell.org/ghc/ghc.git /ghc-8.10.7-src \
&& cd /ghc-8.10.7-src \
&& printf 'BuildFlavour = quick\ninclude mk/flavours/quick.mk\nSTRIP_CMD = :\n' >mk/build.mk \
&& ./boot \
&& HAPPY=$HOME/.cabal/bin/happy-1.19 ./configure --enable-unregisterised --prefix=/ghc-8.10.7 \
&& make -j8 \
&& make install
RUN git clone --depth 1 --branch ghc-9.2.3-release --recurse-submodules https://gitlab.haskell.org/ghc/ghc.git /ghc-9.2.3-src \
&& cd /ghc-9.2.3-src \
&& printf 'BuildFlavour = quick\ninclude mk/flavours/quick.mk\nSTRIP_CMD = :\n' >mk/build.mk \
&& export PATH=/ghc-8.10.7/bin:/usr/bin:/usr/sbin:/sbin:/bin \
&& ./boot \
&& ./configure \
&& make -j8