hadrian source-dist is broken, the generated source dist does not compile
Summary
The command hadrian/build.sh source-dist
generates source archive that does not compile.
Steps to reproduce
- clone GHC git repository:
git clone --recursive https://gitlab.haskell.org/ghc/ghc.git
./boot
./configure
hadrian/build.sh source-dist
- extract and boot/configure/compile the genertated archive (i.e. ghc-8.11.0.20200215-src.tar.xz)
Compilation output of the source-dist with hadrian:
# 1. hadrian source-dist generated: ghc-8.11.0.20200215-src.tar.xz from ghc git head
# 2. extract and boot/configure/compile ghc-8.11.0.20200215-src.tar.xz with hadrian/build.sh -j
| Run Ghc CompileHs Stage0: libraries/Cabal/Cabal/Distribution/CabalSpecVersion.hs => _build/stage0/libraries/Cabal/Cabal/build/Distribution/CabalSpecVersion.o
| Run Ghc CompileHs Stage0: libraries/Cabal/Cabal/Distribution/Compat/DList.hs => _build/stage0/libraries/Cabal/Cabal/build/Distribution/Compat/DList.o
| Run Ghc CompileHs Stage0: libraries/Cabal/Cabal/Distribution/Lex.hs => _build/stage0/libraries/Cabal/Cabal/build/Distribution/Lex.o
| Run Ghc CompileHs Stage0: libraries/Cabal/Cabal/Distribution/Fields/Lexer.hs => _build/stage0/libraries/Cabal/Cabal/build/Distribution/Fields/Lexer.o
| Run Ghc CompileHs Stage0: libraries/Cabal/Cabal/Distribution/Pretty.hs => _build/stage0/libraries/Cabal/Cabal/build/Distribution/Pretty.o
<no location info>: error:
module ‘ghc-8.6.2:Lexer’ is defined in multiple files: compiler/GHC/Cmm/Lexer.hs
compiler/parser/Lexer.hs
Error when running Shake build system:
at action, called at src/Rules.hs:71:19 in main:Rules
at need, called at src/Rules.hs:93:5 in main:Rules
* Depends on: _build/stage0/lib/package.conf.d/ghc-8.11.0.20200215.conf
at need, called at src/Rules/Register.hs:116:5 in main:Rules.Register
* Depends on: _build/stage0/compiler/build/libHSghc-8.11.0.20200215.a
at need, called at src/Rules/Library.hs:146:5 in main:Rules.Library
* Depends on: _build/stage0/compiler/build/Hooks.o
at &%>, called at src/Rules/Compile.hs:62:9 in main:Rules.Compile
* Depends on: _build/stage0/compiler/build/Hooks.o _build/stage0/compiler/build/Hooks.hi
at apply1, called at src/Development/Shake/Internal/Rules/Oracle.hs:159:32 in shake-0.18.3-a2e904f154f09728357733d7a3e8955a2a87773d2d7eb963a6f88d9d883fdde3:Development.Shake.Internal.Rules.Oracle
* Depends on: OracleQ (KeyValues ("_build/stage0/compiler/.dependencies","_build/stage0/compiler/build/Hooks.o"))
at need, called at src/Hadrian/Oracles/TextFile.hs:96:9 in main:Hadrian.Oracles.TextFile
* Depends on: _build/stage0/compiler/.dependencies
at readFile', called at src/Rules/Dependencies.hs:34:19 in main:Rules.Dependencies
at need, called at src/Development/Shake/Internal/Derived.hs:118:15 in shake-0.18.3-a2e904f154f09728357733d7a3e8955a2a87773d2d7eb963a6f88d9d883fdde3:Development.Shake.Internal.Derived
* Depends on: _build/stage0/compiler/.dependencies.mk
* Raised the exception:
user error (Development.Shake.cmd, system command failed
Command line: /usr/local/bin/ghc -M -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage0/lib/package.conf.d' '-this-unit-id ghc-8.11.0.20200215' '-package-id array-0.5.3.0' '-
Compilation output of the source-dist with make:
# 1. hadrian source-dist generated: ghc-8.11.0.20200215-src.tar.xz from ghc git head
# 2. extract and boot/configure/compile ghc-8.11.0.20200215-src.tar.xz with make -j3
make -j3
+ test -f mk/config.mk.old
+ cp -p mk/config.mk mk/config.mk.old
touch -r mk/config.mk.old mk/config.mk
+ test -f mk/project.mk.old
+ cp -p mk/project.mk mk/project.mk.old
touch -r mk/project.mk.old mk/project.mk
+ test -f compiler/ghc.cabal.old
+ cp -p compiler/ghc.cabal compiler/ghc.cabal.old
touch -r compiler/ghc.cabal.old compiler/ghc.cabal
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
utils/genprimopcode/ghc.mk:19: utils/genprimopcode/dist/package-data.mk: No such file or directory
utils/deriveConstants/ghc.mk:19: utils/deriveConstants/dist/package-data.mk: No such file or directory
utils/genapply/ghc.mk:26: utils/genapply/dist/package-data.mk: No such file or directory
libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk: No such file or directory
libraries/binary/ghc.mk:3: libraries/binary/dist-boot/package-data.mk: No such file or directory
libraries/text/ghc.mk:3: libraries/text/dist-boot/package-data.mk: No such file or directory
libraries/transformers/ghc.mk:3: libraries/transformers/dist-boot/package-data.mk: No such file or directory
libraries/mtl/ghc.mk:3: libraries/mtl/dist-boot/package-data.mk: No such file or directory
libraries/parsec/ghc.mk:3: libraries/parsec/dist-boot/package-data.mk: No such file or directory
libraries/Cabal/Cabal/ghc.mk:3: libraries/Cabal/Cabal/dist-boot/package-data.mk: No such file or directory
libraries/ghc-boot-th/ghc.mk:3: libraries/ghc-boot-th/dist-boot/package-data.mk: No such file or directory
libraries/ghc-boot/ghc.mk:3: libraries/ghc-boot/dist-boot/package-data.mk: No such file or directory
libraries/template-haskell/ghc.mk:3: libraries/template-haskell/dist-boot/package-data.mk: No such file or directory
libraries/ghc-heap/ghc.mk:3: libraries/ghc-heap/dist-boot/package-data.mk: No such file or directory
libraries/terminfo/ghc.mk:3: libraries/terminfo/dist-boot/package-data.mk: No such file or directory
libraries/ghci/ghc.mk:3: libraries/ghci/dist-boot/package-data.mk: No such file or directory
ghc.mk:716: libraries/integer-gmp/gmp/ghc.mk: No such file or directory
compiler/ghc.mk:301: compiler/stage1/package-data.mk: No such file or directory
utils/hsc2hs/ghc.mk:21: utils/hsc2hs/dist/package-data.mk: No such file or directory
utils/ghc-pkg/ghc.mk:61: utils/ghc-pkg/dist/package-data.mk: No such file or directory
ghc/ghc.mk:117: ghc/stage1/package-data.mk: No such file or directory
ghc.mk:1221: warning: overriding recipe for target 'sdist_compiler_stage2_Cmm'
ghc.mk:1220: warning: ignoring old recipe for target 'sdist_compiler_stage2_Cmm'
mkdir -p inplace/bin
make[1]: *** No rule to make target 'libraries/integer-gmp/gmp/ghc.mk'. Stop.
make[1]: *** Waiting for unfinished jobs....
mkdir -p inplace/lib
"rm" -f inplace/bin/mkdirhier..
echo '#!/bin/sh' >> inplace/bin/mkdirhier
cat utils/mkdirhier/mkdirhier.sh >> inplace/bin/mkdirhier
chmod +x inplace/bin/mkdirhier
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2
Expected behavior
The generated source distribution should compile with both hadrian and make.
Could the source-dist generator be tested via CI?
Environment
- GHC version used: bootstrap GHC 8.6.2, GHC master git hash: 785008c1
Optional:
- Operating System: Ubuntu 16.04
- System Architecture: x64