Motivation
The Windows runtime artifacts (onnxruntime.dll, both the DirectML and the CPU-only variants) are /MD builds, so their PE import table pulls in four VC++ Redistributable DLLs (VCRUNTIME140.dll, VCRUNTIME140_1.dll, MSVCP140.dll, MSVCP140_1.dll). On a clean Windows image without the redistributable (e.g. the PVE Windows Server 2022 guest in #284), LoadLibraryExW fails with error 126.
#361 mitigates this by deploying the four pinned Microsoft CRT DLLs app-local next to openkara.exe. That works, but it is a mitigation: the repo carries ~768 KB of Microsoft binaries and has to track CRT servicing manually.
The strategic fix is to build the runtime artifact itself with the static CRT (/MT) so it has zero redistributable dependencies. Research notes: onnxruntime's own build.py supports this as a first-class switch (--enable_msvc_static_runtime), it is the upstream-recommended path for redist-free deployments (microsoft/onnxruntime#26024 — note the official NuGet binaries are /MD, so they are not a precedent; WinAppSDK's embedded ORT is), and the combination with the DirectML EP is known to work (microsoft/onnxruntime#17774) since DirectML.dll is a self-contained redistributable reached across a COM/C ABI boundary.
Upstream change
- thedavidweng/openkara-models#90 — switches both Windows targets to
CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded+ONNX_USE_MSVC_STATIC_RUNTIME=ON+protobuf_MSVC_STATIC_RUNTIME=ON+ABSL_MSVC_STATIC_RUNTIME=ON(the exact flag set upstreambuild.py --enable_msvc_static_runtimeuses for v1.27.1). Kept as a draft until a real build is verified.
Dependency chain
- openkara-models: verify a real Windows build of PR #90 — parse the PE import table of both produced
onnxruntime.dllfiles and assert noVCRUNTIME140*/MSVCP140*imports (script included in the PR), smoke harness green, record the actual size delta; then merge. Done 2026-08-12: all 6 targets green, zero redist imports on both DLLs (UCRT imports gone too), +0.6 MiB per DLL (+3–4%); merged as98a1aeb. - openkara-models: publish a new release tag (
ort-v*/infra-*) and catalog generation with the static-CRT artifacts. Done 2026-08-13: publish run 31670494161 built all 6 targets from98a1aeb; releaseinfra-2026-08-12-001ships the archives + supply chain; catalog generation 13 merged as thedavidweng/openkara-models#91 (f3f54c7), stable pointer advanced. - OpenKara: bump
src-tauri/catalog/release-manifest.jsonto the new generation (currently 12) with the new artifact URLs/digests, and update the recorded build flags. Done 2026-08-13: #391 (merged6b9505b) embeds generation 13; fresh-staged all three host targets locally and the Windows installed-app full suite passed on the branch. - OpenKara: confirm zero-redist on the #284 reproduction environment (clean Windows image, no VC++ Redistributable): DLL loads and separation runs on the CPU path.
- OpenKara: remove the app-local CRT mitigation from #361 once the new runtime generation ships: Done 2026-08-13: #392 (merge
992e7d1d) removes the resources/test/CI assertions and records the supersession in ADR 0025.src-tauri/resources/windows/vcredist/(the four CRT DLLs +manifest.json)src-tauri/tests/windows_vcredist_resources.rs- the post-install CRT assertions in
.github/workflows/reusable-windows-installed-app.yml - update ADR 0024 (
docs/adr/0024-windows-runtime-load-strategy.md) to record the strategic fix superseding the app-local deployment.
Notes
DirectML.dllis unaffected: it is Microsoft's prebuilt redistributable, itself statically linked (imports onlyapi-ms-win-core-*andd3d12.dll), and stays a companion DLL of the DirectML variant.- Expected artifact growth from embedding the CRT: roughly +0.5–1.5 MB uncompressed per DLL (baseline: CPU-only reduced DLL is ~13.9 MB); exact numbers land in the openkara-models PR after the verification build.
- Until the chain completes, the #361 app-local CRT deployment remains the shipped mitigation.