haskellPackages.gtk2hs-buildtools: attempt to fix on aarch64-linux

We employ a workaround for a GHC bug [1] which has been adopted by both
Debian and Fedora for a eerily similar problem on ppc64le. Hopefully
this fixes our aarch64 issue as well (untested so far). -O0 is not
ideal, but compilation with -fllvm fails when linking (due to an
invalid relocation and passing -fPIC wasn't enough to fix it), so
we're stuck with this for now.

[1]: https://gitlab.haskell.org/ghc/ghc/-/issues/17203
This commit is contained in:
sternenseemann 2021-08-04 22:36:53 +02:00
parent d6df0aba80
commit 31b625666e

View File

@ -1924,4 +1924,17 @@ EOT
# https://github.com/emilypi/Base16/issues/9
base16 = dontCheck super.base16;
# gtk2hsC2hs fails to build on certain architectures (aarch64, ppc64(le), ...)
# with a linker error. As a workaround, we build gtk2hs-buildtools with -O0
# as suggested in the GHC thread below. An alternative to this could be to use
# -fllvm. I haven't been able to get this to work without linker errors, though.
# See also:
# * https://gitlab.haskell.org/ghc/ghc/-/issues/17203
# * https://github.com/gtk2hs/gtk2hs/issues/305
# * https://github.com/gtk2hs/gtk2hs/issues/279
gtk2hs-buildtools = appendConfigureFlags super.gtk2hs-buildtools
(pkgs.lib.optionals (with pkgs.stdenv.hostPlatform; isAarch64 || isPowerPC) [
"--ghc-option=-O0"
]);
} // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super