From d809bbc25a5cc864dcb1bd4cd168f86acb6b234c Mon Sep 17 00:00:00 2001 From: MiTHRAL Date: Thu, 27 Aug 2026 14:19:46 -0400 Subject: [PATCH] windows-build.cmd: also exclude MSYS environment conversion (%LIB%) The kernel32.lib LNK1104 persists despite MSYS2_ARG_CONV_EXCL because that only protects command-line ARGUMENTS - MSYS/Git Bash still rewrites the %LIB% ENVIRONMENT variable (backslashes + semicolons), so link.exe receives POSIX paths and cannot find kernel32.lib. Set MSYS2_ENV_CONV_EXCL=* too, and print LIB + warn when it is empty after vcvarsall. --- tools/release/windows-build.cmd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/release/windows-build.cmd b/tools/release/windows-build.cmd index 982f10b..98a6b8d 100644 --- a/tools/release/windows-build.cmd +++ b/tools/release/windows-build.cmd @@ -42,8 +42,18 @@ if errorlevel 1 ( exit /b 1 ) -rem Prevent Git Bash from converting/corrupting %LIB% and semicolon paths. +rem Prevent Git Bash from converting/corrupting the MSVC environment. +rem MSYS2_ARG_CONV_EXCL protects command-line ARGUMENTS; the actual +rem kernel32.lib LNK1104 is caused by MSYS rewriting the %LIB% ENVIRONMENT +rem variable (backslashes + semicolons), which requires MSYS2_ENV_CONV_EXCL. set "MSYS2_ARG_CONV_EXCL=*" +set "MSYS2_ENV_CONV_EXCL=*" + +if "%LIB%"=="" ( + echo [WARN] LIB is empty after vcvarsall - try a different WINSDK + echo e.g. set WINSDK=10.0.22621.0 +) +echo LIB=%LIB% rem Convert the repo path to forward slashes for Git Bash (%~dp0 is rem tools\release\ with a trailing backslash; ..\.. reaches the repo root).