Skip to content

Improved testing of cross-compiler

It is already possible to build cross compiler eg from x86_64/linux to armhf/linux or arm64/linux, but there is currently no way to run the test suite.

However, at least for the host and targets above, it should be possible to run the test executables under the Qemu user space emulation. I know this works, because in my own personal jenkins build instance, I test exactly this by doing (for x86_64/linux to amr64/linux cross):

echo -e 'main :: IO ()\nmain = putStrLn "Hello World"\n' > hello-world.hs
inplace/bin/ghc-stage1 hello-world.hs -o hello-world
test $(file hello-world | grep -c 'ARM aarch64, version 1') -eq 1
./hello-world

The linux machine I run the above test on is x86_64/linux but has Qemu and binfmt stuff set up so that it can run some foreign binaries. For instance, if GHC worked as a Linux to Windows cross-compiler the resulting windows binaries should work under Wine.

To get this working, I suspect that just about all the required work is in the build system. Not sure if it might not be better to wait until the Shake based build system is in better shape.

Trac metadata
Trac field Value
Version 7.10.3
Type Task
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Test Suite
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information