Statically compiling a Windows binary with mingw that needs pthreads?

Applying the fix from this thread worked for us: Statically linked mingw binaries - #3 by yshui

Eg, adding the following to the build block (pkgs.pkgsCross.mingwW64.stdenv.mkDerivation):

buildInputs = [
          (pkgs.pkgsCross.mingwW64.windows.mcfgthreads.overrideAttrs {
            dontDisableStatic = true;
          })
        ];
1 Like