Skip to content

Commit ecde37b

Browse files
fix(release): enforce minimum VC++ runtime version for onnxruntime/sherpa-onnx
Adds a file-version check for vcruntime140.dll in the release native-dependency verifier script. VCRuntime.CefSharp.140 1.0.5 ships 14.29 (VS 2019 16.11), but OnnxRuntime 1.26 and sherpa-onnx 1.13 are compiled with VS 2022 and need 14.40+. Bundling 14.29 causes sherpa-onnx-c-api to fail DLL initialisation (0x8007045A), crash-looping the tray on startup (issue #703). Changes: - Add $Script:MinVCRuntimeVersion = 14.40.0.0 constant with explanatory comment - In the app-local VC runtime check loop, verify vcruntime140.dll file version is >= 14.40.0.0 on Windows and emit a clear error pointing to issue #703 when not - Update script description to document the multi-library VC runtime dependency - Add ReleaseWorkflow_VCRuntimeMinimumVersionIsEnforced test to pin the check The version check runs only on Windows (FileVersionInfo reads Windows PE metadata). CI will catch the mismatch on the next x64/arm64 build leg. Closes #703 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4be0057 commit ecde37b

2 files changed

Lines changed: 45 additions & 4 deletions

File tree

scripts/Test-ReleaseNativeDependencies.ps1

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
Verifies native release payload dependencies needed on clean Windows hosts.
44
55
.DESCRIPTION
6-
The Windows node uses NSec.Cryptography, which loads libsodium.dll. The
7-
NuGet-provided Windows libsodium binary imports the Visual C++ runtime, so
8-
app-local/installer payloads must make that runtime available before the
9-
tray can generate or load device keys.
6+
The Windows node uses NSec.Cryptography, which loads libsodium.dll, and
7+
SherpaOnnx + OnnxRuntime for Piper TTS. These native binaries import the
8+
Visual C++ runtime, so app-local/installer payloads must include a runtime
9+
DLL version that satisfies every bundled native library's requirements.
10+
11+
VC++ runtime version compatibility:
12+
- VCRuntime.CefSharp.140 1.0.5 ships 14.29 (VS 2019 16.11).
13+
- OnnxRuntime 1.26 and sherpa-onnx 1.13 are compiled with VS 2022 and
14+
require a VC++ runtime >= 14.40. Bundling 14.29 causes sherpa-onnx-c-api
15+
to fail DLL initialisation (0x8007045A), crash-looping the tray on
16+
startup. See issue #703.
1017
#>
1118
[CmdletBinding()]
1219
param(
@@ -25,6 +32,11 @@ param(
2532
Set-StrictMode -Version Latest
2633
$ErrorActionPreference = "Stop"
2734

35+
# Minimum VC++ runtime file version required by the bundled native stack.
36+
# OnnxRuntime 1.26 and sherpa-onnx 1.13 are compiled with VS 2022 (MSVC 14.40+).
37+
# VCRuntime.CefSharp.140 1.0.5 ships 14.29 (VS 2019) which is too old; see issue #703.
38+
$Script:MinVCRuntimeVersion = [Version]"14.40.0.0"
39+
2840
$payloadRoot = (Resolve-Path -LiteralPath $PayloadPath).Path
2941
$errors = New-Object System.Collections.Generic.List[string]
3042
$runningOnWindows = $env:OS -eq "Windows_NT"
@@ -108,6 +120,21 @@ foreach ($libsodium in $libsodiumFiles) {
108120
if ($RequireAppLocalVCRuntime) {
109121
foreach ($runtimeFile in Get-VCRuntimeFiles -Directory $libsodium.DirectoryName) {
110122
Add-MicrosoftSignatureErrors -File $runtimeFile
123+
124+
# Enforce minimum VC++ runtime version required by OnnxRuntime/sherpa-onnx.
125+
# FileVersionInfo reads Windows PE metadata; skip when not on Windows.
126+
if ($runningOnWindows -and $runtimeFile.Name -eq "vcruntime140.dll") {
127+
$fvi = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($runtimeFile.FullName)
128+
$actual = [Version]"$($fvi.FileMajorPart).$($fvi.FileMinorPart).$($fvi.FileBuildPart).$($fvi.FilePrivatePart)"
129+
if ($actual -lt $Script:MinVCRuntimeVersion) {
130+
$errors.Add(
131+
"$(Get-RelativePath -Root $payloadRoot -Path $runtimeFile.FullName) " +
132+
"file version $actual is below minimum $Script:MinVCRuntimeVersion " +
133+
"required by OnnxRuntime/sherpa-onnx (issue #703). " +
134+
"Update VCRuntime.CefSharp.140 to a package version that ships $Script:MinVCRuntimeVersion+ DLLs."
135+
)
136+
}
137+
}
111138
}
112139
}
113140

tests/OpenClaw.Tray.Tests/ReleaseSigningWorkflowTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ private static string ExtractReleaseStep(string workflow)
109109
return workflow[start..];
110110
}
111111

112+
[Fact]
113+
public void ReleaseWorkflow_VCRuntimeMinimumVersionIsEnforced()
114+
{
115+
// Regression gate for issue #703: VCRuntime.CefSharp.140 1.0.5 ships VC++ 14.29
116+
// (VS 2019), but OnnxRuntime 1.26 / sherpa-onnx 1.13 are compiled with VS 2022
117+
// and need 14.40+. The verifier must catch this before a bad runtime reaches users.
118+
var verifier = File.ReadAllText(Path.Combine(GetRepositoryRoot(), "scripts", "Test-ReleaseNativeDependencies.ps1"));
119+
120+
Assert.Contains("MinVCRuntimeVersion", verifier);
121+
Assert.Contains("14.40.0.0", verifier);
122+
Assert.Contains("FileVersionInfo", verifier);
123+
Assert.Contains("703", verifier);
124+
}
125+
112126
private static string GetRepositoryRoot()
113127
{
114128
var env = Environment.GetEnvironmentVariable("OPENCLAW_REPO_ROOT");

0 commit comments

Comments
 (0)