Opened 2 months ago

Last modified 5 days ago

#16051 new bug

Cross compilation broken under Hadrian

Reported by: bgamari Owned by: alpmestan
Priority: highest Milestone: 8.8.1
Component: Build System (Hadrian) Version: 8.7
Keywords: Cc: alpmestan, snowleopard, angerman
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by bgamari)

Hadrian falls over essentially immediately when cross-compiling:

$ ./boot
$ ./configure --target=aarch64-linux-gnu
$ hadrian/build.cabal.sh -j32
Up to date
Up to date
| Copy file: settings => _build/stage1/lib/settings
| Copy file: settings => _build/stage0/lib/settings
| Copy file: utils/hsc2hs/template-hsc.h => _build/stage0/lib/template-hsc.h
| Copy file: llvm-targets => _build/stage0/lib/llvm-targets
| Copy file: driver/ghc-usage.txt => _build/stage0/lib/ghc-usage.txt
| Copy file: llvm-passes => _build/stage0/lib/llvm-passes
| Copy file: driver/ghci-usage.txt => _build/stage0/lib/ghci-usage.txt
shakeArgsWith   0.000s    0%                           
Function shake  0.084s   20%  ======                   
Database read   0.000s    0%                           
With database   0.000s    0%                           
Running rules   0.329s   79%  =========================
Total           0.415s  100%                           
Error when running Shake build system:
  at src/Rules.hs:(35,19)-(48,17):
  at src/Rules.hs:48:5-17:
* Depends on: _build/stage2/bin/aarch64-linux-gnu-ghctags
  at src/Hadrian/Utilities.hs:292:5-18:
* Depends on: _build/stage0/bin/aarch64-linux-gnu-ghctags
* Raised the exception:
Unknown program "_build/stage0/bin/aarch64-linux-gnu-ghctags"
CallStack (from HasCallStack):
  error, called at src/Rules/Program.hs:26:29 in main:Rules.Program

Change History (6)

comment:1 Changed 2 months ago by bgamari

Cc: alpmestan snowleopard added

comment:2 Changed 2 months ago by bgamari

Description: modified (diff)

comment:3 Changed 2 months ago by bgamari

I believe this broke due to 665f8b0c778b3a5dac4696f81da0cea88b101ea9.

comment:4 Changed 2 months ago by alpmestan

Cc: angerman added

comment:5 Changed 5 days ago by alpmestan

Owner: set to alpmestan

comment:6 Changed 5 days ago by alpmestan

ghctags being gone, I don't have any problem getting the build to complete with this very simple patch:

  • hadrian/src/UserSettings.hs

    diff --git a/hadrian/src/UserSettings.hs b/hadrian/src/UserSettings.hs
    index c92dd11d44..b6fc30bd90 100644
    a b successColour = mkSuccessColour (Dull Green) 
    5959-- 'Stage1' compiler. Setting it to 'Stage3' will build the 'Stage3'
    6060-- compiler. Setting it to 'Stage0' will mean nothing gets built at all.
    6161finalStage :: Stage
    62 finalStage = Stage2
     62finalStage = Stage1

(this is a setting Matthew introduced somewhat recently, documented in hadrian's docs)

With this in place, a simple hadrian/build.sh -j4 builds stage 1 to completion. However, trying to build this trivial Haskell program then fails:

main = putStrLn "hello"

with

$ _build/stage0/bin/aarch64-unknown-linux-gnu-ghc hello.hs -o hello
[1 of 1] Compiling Main             ( hello.hs, hello.o )

hello.hs:1:1: error:
    Bad interface file: /nix/store/8h3fdgpq66w8kxzxn49s706505a7ihnr-ghc-8.4.3/lib/ghc-8.4.3/base-4.11.1.0/Prelude.hi
        mismatched interface file versions (wanted "80720190211", got "8043")
  |
1 | main = putStrLn "hello"
  | ^

The cross-compiler ends up looking at the boot compiler's interface files instead of its own.

Note: See TracTickets for help on using tickets.