Skip to content

Building cross-compiler for arm32 fails with error in Rts.h

Summary

Building GHC as the cross-compiler for arm32 fails during build of rts:

...
# cabal-configure (for _build/stage1/rts/setup-config)
Configuring rts-1.0.2...
...
Reading parameters from
/home/mizuki/ghc-arm32/_build/stage1/rts/build/rts.buildinfo
Error: hadrian: Missing dependency on a foreign library:
* Missing (or bad) header file: Rts.h
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

ExitFailure 1
Build failed.

hadrian/build --verbose gives:

...
/usr/bin/arm-linux-gnueabihf-gcc returned ExitFailure 1
/usr/bin/arm-linux-gnueabihf-gcc returned ExitFailure 1 with error message:
In file included from rts/include/stg/MachRegsForHost.h:88,
from rts/include/Stg.h:393,
from rts/include/Rts.h:38,
from /tmp/154980-35.c:1:
rts/include/stg/MachRegs.h:688:2: error: #error Cannot find platform to give
register info for
688 | #error Cannot find platform to give register info for
| ^~~~~
CallStack (from HasCallStack):
  withMetadata, called at src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.1.0-1b15bbadb88194c4fbf804f8dad22608af27a0d45235499584abbc59a564a73a:Distribution.Simple.Utils
Error: hadrian: Missing dependency on a foreign library:
* Missing (or bad) header file: Rts.h
...

Steps to reproduce

$ ./boot
$ ./configure --target=arm-linux-gnueabihf
$ hadrian/build -j

Expected behavior

Building GHC should succeed.

Environment

  • GHC version used: 9.4.7 to build 7d390bce
  • Operating System: Ubuntu
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information