From b4de5e37147ec43e5e6e8cceaf9e08e56b100044 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Mon, 6 Oct 2025 01:41:06 +0100 Subject: [PATCH] haskellPackages: fix executable builds on pkgsCross.ucrt64 --- pkgs/development/compilers/ghc/common-hadrian.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 6538bbfe3608..5412b8fb1325 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -55,7 +55,8 @@ gmp, # If enabled, use -fPIC when compiling static libs. - enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform, + enableRelocatedStaticLibs ? + stdenv.targetPlatform != stdenv.hostPlatform && !stdenv.targetPlatform.isWindows, # Exceeds Hydra output limit (at the time of writing ~3GB) when cross compiled to riscv64. # A riscv64 cross-compiler fits into the limit comfortably. @@ -332,6 +333,8 @@ let # documentation) makes the GHC RTS able to load static libraries, which may # be needed for TemplateHaskell. This solution was described in # https://www.tweag.io/blog/2020-09-30-bazel-static-haskell + # + # Note `-fexternal-dynamic-refs` causes `undefined reference` errors when building GHC cross compiler for windows lib.optionals enableRelocatedStaticLibs [ "*.*.ghc.*.opts += -fPIC -fexternal-dynamic-refs" ]