Skip to content

Commit fe4b4ea

Browse files
committed
Fix mingw_w64_pthreads: rebuild with working cross-stdenv
nixpkgs-2511's crossThreadsStdenv resolves to native Linux stdenv instead of the cross-compiling stdenv, causing dll_dependency.S to be assembled with the 64-bit Linux assembler which rejects 32-bit Windows push/pop instructions. Rebuild from the same mingw-w64 source using prev.stdenv (the full Windows cross-stdenv) which properly provides the cross-compiler. No circular dependency because GCC uses MCF threads (depends on mcfgthreads, not pthreads).
1 parent eb3e0c5 commit fe4b4ea

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

flake.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@
122122
# but the package only creates a dlltool wrapper, not windres.
123123
# The prefixed x86_64-w64-mingw32-windres exists in the cross-bintools
124124
# but meson searches for the unprefixed name. Same pattern as dlltool.
125+
#
126+
# mingw_w64_pthreads: nixpkgs-2511's crossThreadsStdenv resolves to
127+
# native Linux stdenv instead of the cross-compiling stdenv, causing
128+
# dll_dependency.S to be assembled with the 64-bit Linux assembler
129+
# which rejects 32-bit Windows push/pop instructions. The properly
130+
# cross-compiled version exists in nixpkgs (built via crossLibcStdenv)
131+
# but windows.mingw_w64_pthreads uses the broken crossThreadsStdenv.
132+
# Fix: rebuild from the same mingw-w64 source using the working
133+
# cross-stdenv (prev.windows.mingw_w64 uses crossLibcStdenv which
134+
# properly provides the cross-compiler).
125135
windows = prev.windows // {
126136
mcfgthreads = prev.windows.mcfgthreads.overrideAttrs (old: {
127137
nativeBuildInputs = old.nativeBuildInputs ++ [
@@ -130,6 +140,14 @@
130140
'')
131141
];
132142
});
143+
mingw_w64_pthreads = prev.stdenv.mkDerivation {
144+
name = "${prev.windows.mingw_w64.name}-pthreads";
145+
inherit (prev.windows.mingw_w64) src meta;
146+
configureFlags = [ "--enable-static" ];
147+
preConfigure = ''
148+
cd mingw-w64-libraries/winpthreads
149+
'';
150+
};
133151
};
134152
});
135153

0 commit comments

Comments
 (0)