haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

Cross-compilation to armv7l fails with GHC 9.2.2

Open albertov opened this issue 2 years ago • 0 comments

We're in the process of migrating our code base from GHC 8.8.4 to 9.2.2 and our armv7l target has ceased to work. The error we're seeing seems the same as the one mentioned here https://gitlab.haskell.org/ghc/ghc/-/issues/18024, which is weird because apparently the fix should be present in GHC 9.2.2. Interestingly, the aarch64 target builds fine (I'm assuming thanks to the new native aarch64 code generator in GHC side-stepping LLVM?).

This is the output of nix log xxx.drv:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/qai2k1c0c2jyfy5bbkzh81cszkl844y4-filepath-1.4.2.2.tar.gz
source root is filepath-1.4.2.2
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file filepath-1.4.2.2/tests/TestUtil.hs
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
Configure flags:
--prefix=/nix/store/94fi01rmvc29bcbf666cm1mnaq04skd5-filepath-lib-filepath-armv7l-unknown-linux-gnueabihf-1.4.2.2 lib:filepath --package-db=clear --package-db=/nix/store/nbs1phxx1s1w9j1ivagjyryywrwdhpr1-armv7l-unknown-linux-gnueabihf-filepath-lib-filepath-1>
Configuring library for filepath-1.4.2.2..
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Preprocessing library for filepath-1.4.2.2..
Building library for filepath-1.4.2.2..
[1 of 3] Compiling System.FilePath.Posix ( System/FilePath/Posix.hs, dist/build/System/FilePath/Posix.o )
/nix/store/yjzizxvi16sbkgmcjj3ancjcqd4nfh54-llvm-12.0.1/bin/opt: /build/ghc134_0/ghc_4.ll:727:3: error: multiple definition of local value named 'ln46l'
  %ln46l = inttoptr i32 %ln46l to void (i32*, i32*, i32*, i32, i32, i32, i32, i32)*
  ^

<no location info>: error:
    `opt' failed in phase `LLVM Optimiser'. (Exit code: 1)
[3 of 3] Compiling System.FilePath.Windows ( System/FilePath/Windows.hs, dist/build/System/FilePath/Windows.o )
/nix/store/yjzizxvi16sbkgmcjj3ancjcqd4nfh54-llvm-12.0.1/bin/opt: /build/ghc134_0/ghc_6.ll:2182:3: error: multiple definition of local value named 'ln8dg'
  %ln8dg = load i32*, i32** %Sp_Var
  ^

<no location info>: error:
    `opt' failed in phase `LLVM Optimiser'. (Exit code: 1)

albertov avatar May 09 '22 18:05 albertov