Cannot build GHC libraries with -dppr-debug
Summary
In some NCGs (RISCV64, AArch64) -dppr-debug -ddump-asm
emits nicer Assembly code with e.g. related Cmm expressions in comments. Unfortunately, building the libraries with -dppr-debug
fails:
| Run Ghc CompileHs Stage1: libraries/ghc-internal/src/GHC/Internal/Conc/Signal.hs => _build/stage1/libraries/ghc-internal/build/GHC/Internal/Conc/Signal.o
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:9:140: error:
error: expected ‘)’ before ‘Just’
9 | extern StgClosure (ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^~~~~
| )
|
Command line: _build/stage0/bin/aarch64-unknown-linux-gnu-ghc -Wall -Wcompat -fdiagnostics-color=never -dynamic-too -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-env -' '-package-db _build/stage1/inplace/package.conf.d' '-this-unit-id ghc-internal-9.1100.0-inplace' '-this-package-name ghc-internal' '-package-id ghc-bignum-1.3-inplace' '-package-id ghc-prim-0.11.0-inplace' '-package-id rts-1.0.2' -i -i/home/sven/src/ghc-aarch64/_build/stage1/libraries/ghc-internal/build -i/home/sven/src/ghc-aarch64/_build/stage1/libraries/ghc-internal/build/autogen -i/home/sven/src/ghc-aarch64/libraries/ghc-internal/src -Irts/include -I_build/stage1/libraries/ghc-internal/build -I_build/stage1/libraries/ghc-internal/build/include -Ilibraries/ghc-internal/include -I/home/sven/src/ghc-aarch64/libraries/ghc-bignum/include/ -I/home/sven/src/ghc-aarch64/_build/stage1/libraries/ghc-bignum/build/include/ -I/home/sven/src/ghc-aarch64/rts/include -I/home/sven/src/ghc-aarch64/_build/stage1/rts/build/include -optP-include -optP_build/stage1/libraries/ghc-internal/build/autogen/cabal_macros.h -outputdir _build/stage1/libraries/ghc-internal/build -this-unit-id ghc-internal -Wcompat -Wnoncanonical-monad-instances -XHaskell2010 -XNoImplicitPrelude -no-global-package-db -package-db=/home/sven/src/ghc-aarch64/_build/stage1/inplace/package.conf.d -ghcversion-file=rts/include/ghcversion.h -ghcversion-file=rts/include/ghcversion.h -Wnoncanonical-monad-instances -optc-Wno-error=inline -c libraries/ghc-internal/src/GHC/Internal/Conc/Bound.hs -o _build/stage1/libraries/ghc-internal/build/GHC/Internal/Conc/Bound.o -fllvm-fill-undef-with-garbage -dno-debug-output -fcheck-prim-bounds -O0 -optc=-O0 -ddump-to-file -ddump-asm -dppr-debug -Werror -dlint -g3 -Wno-deprecated-flags -Wno-trustworthy-safe
===> Command failed with error code: 1
9 | extern StgClosure (ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:9:146: error:
warning: missing terminating ' character
9 | extern StgClosure (ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
|
9 | extern StgClosure (ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:9:146: error:
error: missing terminating ' character
9 | extern StgClosure (ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
9 | extern StgClosure (ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c: In function ‘forkOS_entry’:
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:19:73: error:
error: ‘ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry’ undeclared (first use in this function)
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:19:73: error:
note: each undeclared identifier is reported only once for each function it appears in
|
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:19:193: error:
error: expected ‘)’ before ‘Just’
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ~ ^~~~~
| )
|
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:19:199: error:
warning: missing terminating ' character
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
|
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:19:199: error:
error: missing terminating ' character
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:23:267: error:
error: expected ‘)’ before ‘_closure’
23 | ghczmprim_GHCziTuple_Unit)_closure,rts_mkStablePtr(cap,a1))) ,&ret);
| ^~~~~~~~
| )
|
23 | ghczmprim_GHCziTuple_Unit)_closure,rts_mkStablePtr(cap,a1))) ,&ret);
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:19:66: error:
note: to match this ‘(’
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
|
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:19:57: error:
error: too few arguments to function ‘rts_apply’
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^~~~~~~~~
|
19 | rts_inCall(&cap,rts_apply(cap,(HaskellObj)runIO_closure,rts_apply(cap,&(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
In file included from rts/include/Rts.h:41,
from /home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:2:0: error:
rts/include/RtsAPI.h:466:14: error:
note: declared here
466 | HaskellObj rts_apply ( Capability *, HaskellObj, HaskellObj );
| ^~~~~~~~~
|
466 | HaskellObj rts_apply ( Capability *, HaskellObj, HaskellObj );
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c: At top level:
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:27:100: error:
error: ‘ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry’ undeclared here (not in a function)
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:27:220: error:
error: expected ‘)’ before ‘Just’
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ~ ^~~~~
| )
|
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:27:226: error:
warning: missing terminating ' character
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
|
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:27:226: error:
error: missing terminating ' character
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:31:294: error:
error: expected ‘}’ before ‘_closure’
31 | ghczmprim_GHCziTuple_Unit)_closure}, .n_entries = 1};
| ^~~~~~~~
|
31 | ghczmprim_GHCziTuple_Unit)_closure}, .n_entries = 1};
| ^
/home/sven/tmp/ghc/ghc2628642_tmp_0/ghc_tmp_4.c:27:88: error:
note: to match this ‘{’
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
|
27 | static struct ForeignExportsList stg_exports_GHCziInternalziConcziBound = {.exports = {(StgPtr) &(ghczminternal_GHCziInternalziConcziBound_zdfstableZZC0ZZCghczzminternalZZCGHCzziInternalzziConczziBoundZZCforkOSzzuentry Just 'ghczmprim_GHCziTypes_Many [lidx] :: ghczminternal_GHCziInternalziStable_StablePtr
| ^
`aarch64-unknown-linux-gnu-cc' failed in phase `C Compiler'. (Exit code: 1)
Command failed
Build failed.
Steps to reproduce
Create a flavour that builds with the mentioned flags:
diff --git a/hadrian/src/Settings/Flavours/Validate.hs b/hadrian/src/Settings/Flavours/Validate.hs
index b322e76636..e17b513511 100644
--- a/hadrian/src/Settings/Flavours/Validate.hs
+++ b/hadrian/src/Settings/Flavours/Validate.hs
@@ -37,7 +37,9 @@ validateArgs = sourceArgs SourceArgs
, notStage0 ? arg "-dno-debug-output"
, notStage0 ? arg "-fcheck-prim-bounds"
]
- , hsLibrary = pure ["-O"]
+ , hsLibrary = mconcat [ stage0 ? pure ["-O"]
+ , notStage0 ? pure ["-O0", "-optc=-O0", "-ddump-to-file", "-ddump-asm", "-dppr-debug" ]
+ ]
, hsCompiler = mconcat [ stage0 ? pure ["-O2"]
, notStage0 ? pure ["-O" ]
]
Run hadrian/build
with this flavour.
Expected behavior
The build should succeed.
Environment
- GHC version used:
master
(80769bc9)
Optional:
- Operating System: Linux
- System Architecture: x86_64 to cross-compile aarch64