Skip to content

Inconsistently choosen header files while registerising

Summary

Hadrian seems to make use of header files coming from stage0 in order to compile stage1. This may lead to inconsistencies. Consider the following example where the stage0 compiler is not registerised and the target compiler is:

...
/--------------------------------------------------------\
| Successfully built library 'ghc' (Stage0, way v).      | 
| Library: _build/stage0/compiler/build/libHSghc-8.8.1.a | 
| Library synopsis: The GHC API.                         |
\--------------------------------------------------------/
| Run Cc FindCDependencies Stage0: ghc/hschooks.c => _build/stage0/ghc/build/c/hschooks.o.d
| Run Ghc FindHsDependencies Stage0: ghc/Main.hs => _build/stage0/ghc/.dependencies.mk
In file included from /usr/lib64/ghc-8.6.5/include/stg/RtsMachRegs.h:72,
                 from /usr/lib64/ghc-8.6.5/include/Stg.h:306,
                 from /usr/lib64/ghc-8.6.5/include/Rts.h:29,
                 from ghc/hschooks.c:14:
/usr/lib64/ghc-8.6.5/include/stg/MachRegs.h:607:2: error: #error Cannot find platform to give register info for
  607 | #error Cannot find platform to give register info for
      |  ^~~~~
Error when running Shake build system:
  at action, called at src/Rules.hs:35:19 in main:Rules
  at need, called at src/Rules.hs:52:5 in main:Rules
* Depends on: _build/stage0/bin/ghc
  at need, called at src/Rules/Program.hs:106:5 in main:Rules.Program
* Depends on: _build/stage0/ghc/build/c/hschooks.o
* Raised the exception:
user error (Development.Shake.cmd, system command failed
Command line: /usr/bin/gcc -E -MM -MG -MF _build/stage0/ghc/build/c/hschooks.o.d -MT _build/stage0/ghc/build/c/hschooks.o -I_build/generated -I_build/stage0/ghc/build -I/devel/src/ghc88/_build/stage0/lib/s390x-linux-ghc-8.6.5/ghc-8.8.1/include -I/usr/lib64/ghc-8.6.5/process-1.6.5.0/include -I/usr/lib64/ghc-8.6.5/unix-2.7.2.2/include -I/usr/lib64/ghc-8.6.5/time-1.8.0.2/include -I/usr/lib64/ghc-8.6.5/bytestring-0.10.8.2/include -I/usr/lib64/ghc-8.6.5/base-4.12.0.0/include -I/usr/lib64/ghc-8.6.5/integer-gmp-1.0.2.0/include -I/usr/lib64/ghc-8.6.5/include -x c ghc/hschooks.c
Exit code: 1 
Stderr:
In file included from /usr/lib64/ghc-8.6.5/include/stg/RtsMachRegs.h:72,
                 from /usr/lib64/ghc-8.6.5/include/Stg.h:306,
                 from /usr/lib64/ghc-8.6.5/include/Rts.h:29,
                 from ghc/hschooks.c:14:
/usr/lib64/ghc-8.6.5/include/stg/MachRegs.h:607:2: error: #error Cannot find platform to give register info for
  607 | #error Cannot find platform to give register info for
      |  ^~~~~
)

Clearly the stage0 compiler has not been registerised and thus /usr/lib64/ghc-8.6.5/include/stg/MachRegs.h does not define registers for the proper target.

Is there any suggested way how to compile a registerised compiler with an unregisterised one?

Environment

  • GHC version used as stage0 compiler: 8.6.5
  • GHC target compiler: 8.8.1-rc2
  • Fedora 30
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information