Skip to content

Fix ARM64 controlled-smoke PCH virtual-memory exhaustion (native host toolchain)

Problem

The Controlled Smoke workflow's arm64_smoke job (runs on the native windows-11-arm runner, controlled-smoke.yml) fails its ARM64 package-release build with, for every .cpp:

error C3859: Failed to create virtual memory for PCH
error C1076: compiler limit: internal heap limit reached

The x64 job passes; local x64 Debug/Release/diagnostics build clean. So this is a CI host/toolchain mismatch, not a source defect.

Root cause

build.py::app_property_overrides forced /p:PreferredToolArchitecture=x64 for every ARM64 build. That override was written for an x64 build agent cross-compiling ARM64 (where the default host is the 32-bit HostX86\arm64 cl.exe). On the native ARM64 runner it instead selects the HostX64\arm64 compiler running under x64 emulation, which still cannot map the large MFC PCH into its address space.

Fix

Make the host-tool architecture host-aware via arm64_host_tool_architecture(): resolve the true machine architecture from PROCESSOR_ARCHITEW6432 / PROCESSOR_ARCHITECTURE (the former reports the real arch even under emulation) and select:

  • native ARM64 host → PreferredToolArchitecture=ARM64 (native HostARM64\arm64, 64-bit, no emulation),
  • x64 host → PreferredToolArchitecture=x64 (unchanged; x64 builds are byte-for-byte unaffected).

Implemented in repos/emulebb-build/emule_workspace/build.py with unit tests in tests/test_build.py (native ARM64, emulated-ARM64, x64-host cases).

Validation

  • [x] pytest tests/test_build.py (17 passed, incl. 3 new host-arch cases).
  • [x] x64 build path unchanged (helper returns x64 on x64 hosts).
  • [x] Re-run Controlled Smoke (workflow_dispatch) and confirm the arm64_smoke job builds + smokes green on windows-11-armPASSED, run 27343000884 (2026-06-11): all jobs success incl. Package and smoke (ARM64, windows-11-arm).

Disposition

DONE. Two same-class fixes landed and validated: build.py host-aware PreferredToolArchitecture (native ARM64 host -> HostARM64) and toolchain.py dumpbin discovery extended to native ARM64 host dirs. x64 builds unchanged.

Risk / fallback

Assumes the runner image ships the native HostARM64\arm64 v143 ATL/MFC tools. If they are missing, either add an ARM64 ATL/MFC ensure-step (mirroring the x64 Ensure-MfcForHostedRunner) or disable PCH for ARM64 CI builds (PrecompiledHeader=NotUsing) as a host-independent fallback.

Acceptance criteria

  • ARM64 controlled-smoke builds + smokes green on windows-11-arm.
  • No change to x64 build behavior.