Skip to content

fix(ENG-RELEASE-WINDOWS): set up MSVC dev environment for dumpbin/cl in build-windows-release.ps1 - #3172

Merged
localai-org-maint-bot merged 1 commit into
mainfrom
fix/windows-msvc-dumpbin
Sep 13, 2026
Merged

fix(ENG-RELEASE-WINDOWS): set up MSVC dev environment for dumpbin/cl in build-windows-release.ps1#3172
localai-org-maint-bot merged 1 commit into
mainfrom
fix/windows-msvc-dumpbin

Conversation

@localai-org-maint-bot

@localai-org-maint-bot localai-org-maint-bot commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

The CRT audit in build-windows-release.ps1 calls dumpbin to inspect PE imports, but dumpbin and cl were not on PATH because vcvars64.bat was never run. The CMake configure uses the Visual Studio generator, which finds the compiler through the registry, so the build itself succeeded. But the post-build CRT audit and PE audit steps failed because the MSVC tools were unavailable. This was masked by the 0xC0000409 crash (fixed in #3168), which prevented execution from reaching the dumpbin calls.

Initialize-MsvcEnvironment uses vswhere to find the VS installation, runs vcvars64.bat via cmd, captures the environment variables, and imports them into the PowerShell session. Contract tests verify the function is called and that $PSNativeCommandUseErrorActionPreference is set to $false so native commands like dumpbin do not trigger ErrorActionPreference Stop.

The dumpbin ErrorRecord output is converted to strings with [string]$_ to avoid the empty-string DirectiveOutput error. CMake CompilerId probe objects (compiled with default /MD) are excluded from artifact collection so they do not trip the static-CRT policy.

The release archive PE import validator rejected every import not in WINDOWS_SYSTEM_DLLS, even when the manifest declared it as a dynamic dependency. OpenSSL DLLs (LIBCRYPTO-3-X64.DLL, LIBSSL-3-X64.DLL) are legitimate runtime dependencies, declared by release_metadata.py, but the system-DLL check caught them as forbidden. Allow declared dynamic dependencies through the system-DLL check. CRT and MinGW checks fire unconditionally and still reject declared forbidden runtime DLLs.

Closes #3171

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:regolo/glm5.2 [MAKI]

… fix PE import validation

The CRT audit in build-windows-release.ps1 calls dumpbin to inspect PE
imports, but dumpbin and cl were not on PATH because vcvars64.bat was never
run. The CMake configure uses the Visual Studio generator, which finds the
compiler through the registry, so the build itself succeeded. But the
post-build CRT audit and PE audit steps failed because the MSVC tools were
unavailable. This was masked by the 0xC0000409 crash (fixed in #3168),
which prevented execution from reaching the dumpbin calls.

Initialize-MsvcEnvironment uses vswhere to find the VS installation, runs
vcvars64.bat via cmd, captures the environment variables, and imports them
into the PowerShell session. Contract tests verify the function is called
and that $PSNativeCommandUseErrorActionPreference is set to $false so
native commands like dumpbin do not trigger ErrorActionPreference Stop.

The dumpbin ErrorRecord output is converted to strings with [string]$_ to
avoid the empty-string DirectiveOutput error. CMake CompilerId probe objects
(compiled with default /MD) are excluded from artifact collection so they
do not trip the static-CRT policy.

The release archive PE import validator rejected every import not in
WINDOWS_SYSTEM_DLLS, even when the manifest declared it as a dynamic
dependency. OpenSSL DLLs (LIBCRYPTO-3-X64.DLL, LIBSSL-3-X64.DLL) are
legitimate runtime dependencies, declared by release_metadata.py, but the
system-DLL check caught them as forbidden. Allow declared dynamic
dependencies through the system-DLL check. CRT and MinGW checks fire
unconditionally and still reject declared forbidden runtime DLLs.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:GLM5.2 [MAKI]
@mudler
mudler force-pushed the fix/windows-msvc-dumpbin branch from 68a36e4 to fad292b Compare September 13, 2026 05:11
@localai-org-maint-bot
localai-org-maint-bot merged commit 43622bc into main Sep 13, 2026
22 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

windows-msvc: build-windows-release.ps1 calls dumpbin/cl without MSVC env on PATH

2 participants