From 6f73c037aadacd6631c5cbcff85ea676772d5ea7 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 13 Dec 2024 18:55:03 -0500 Subject: [PATCH] windows.mingw_w64_headers: fix building against msvcrt Previously we relied on the default CRT selected by upstream. This broke builds against MSVCRT starting with 12.0, as the default was changed to UCRT We can instead manually configure the CRT based on our `stdenv` to ensure there is no discrepancy between the CRT we want to use and that being targeted by the build --- pkgs/os-specific/windows/mingw-w64/headers.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/os-specific/windows/mingw-w64/headers.nix b/pkgs/os-specific/windows/mingw-w64/headers.nix index daae7ee0aa42..34d9a37b6217 100644 --- a/pkgs/os-specific/windows/mingw-w64/headers.nix +++ b/pkgs/os-specific/windows/mingw-w64/headers.nix @@ -2,6 +2,7 @@ lib, stdenvNoCC, fetchurl, + crt ? stdenvNoCC.hostPlatform.libc, }: stdenvNoCC.mkDerivation (finalAttrs: { @@ -13,6 +14,10 @@ stdenvNoCC.mkDerivation (finalAttrs: { hash = "sha256-zEGJiqxLbo3Vz/1zMbnZUVuRLfRCCjphK16ilVu+7S8="; }; + configureFlags = [ + (lib.withFeatureAs true "default-msvcrt" crt) + ]; + preConfigure = '' cd mingw-w64-headers '';