Repository navigation
[Windows] Stop pinning a Windows SDK version by default - #4588
Conversation
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4588PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4588"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4588/packages --name skiasharp-pr-4588More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4588 |
3f0f32a to
eec0894
Compare
📊 SkiaSharp benchmarks — PR #4588⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS
Highlights⏱️ Time — 🔴 54 slower · 🟢 18 faster
Full per-OS benchmark deltasLinux⏱️ Time (vs 🌙 nightly
Windows⏱️ Time (vs 🌙 nightly
macOS⏱️ Time (vs 🌙 nightly
|
bcdcad3 to
29d18a0
Compare
29d18a0 to
d536e1a
Compare
d536e1a to
7a3e822
Compare
The `benchmark-source (windows-latest, ...)` leg of Track - Benchmarks died immediately after "Initializing the Visual C++ environment once for amd64." with `Process 'cmd.exe' failed with error: 1` and no other output. RunNinjaWithVcVars ran `vcvarsall.bat amd64 10.0.22621.0 -vcvars_ver=14.2 >nul`. That version was the default of the new windowsSdkVersion argument and matches the AzDO agents, but the hosted runner is windows-2025-vs2026 and ships only Windows SDK 10.0.26100.0. vcvarsall hard-fails on an SDK that is not installed: [ERROR:winsdk.bat] Windows SDK 10.0.22621.0 : '...\include\...\um' not found and `>nul` swallowed that message whole, leaving only the cmd exit code. Nothing needed that default. gn resolves the SDK itself when it is not pinned, which is what happened before the MSVC environment was initialized explicitly, and it emits the result as explicit -imsvc and /LIBPATH: flags. Hardcoding a version only meant the build broke on any machine that did not happen to have it. Default the argument to empty and omit it from both gn and vcvarsall when unset, so each detects an SDK that exists. Setting it still pins both, so a specific SDK can be selected locally, and dropping `>nul` means the next failure says why. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c396b794-0f5c-4c37-a021-54ab7c95a5cf
7a3e822 to
fa12e1d
Compare
|
📖 Documentation Preview The documentation for this PR has been deployed and is available at: 🔗 View Staging Site This preview will be updated automatically when you push new commits to this PR. This comment is automatically updated by the documentation staging workflow. |
📦 Artifact size reportPackages from this PR (build Total Packages
+38 package(s) unchanged (< 50.0 KB). Per-file changes
|
| File | Size |
|---|---|
runtimes/win-x86/native/libHarfBuzzSharp.pdb |
22.0 MB → 22.2 MB (🔴 +264.0 KB) |
runtimes/win-arm64/native/libHarfBuzzSharp.pdb |
22.3 MB → 22.5 MB (🔴 +192.0 KB) |
SkiaSharp.NativeAssets.WinUI
| File | Size |
|---|---|
runtimes/win-x64/native/libGLESv2.pdb |
66.7 MB → 66.6 MB (🟢 −112.0 KB) |
runtimes/win-arm64/native/libGLESv2.pdb |
64.5 MB → 64.4 MB (🟢 −64.0 KB) |
runtimes/win-x86/native/libGLESv2.pdb |
67.2 MB → 67.2 MB (🟢 −32.0 KB) |
Informational only — this never blocks the PR. Native binaries are labelled by os/arch.
Brings in #4588, which fixes the benchmark-source native build: vcvarsall was handed a Windows SDK version the hosted runner does not have, and >nul hid the error. That was the one red GitHub check. A docs review against the code found four contradictions: The Mac Catalyst comment still said macOS 'is NOT opted out'. That was true when written and stopped being true when macOS was opted out — the same stale claim already fixed on the iOS leg, missed here. review-skia-update's C# checklist still allowed 'no skipped tests (except hardware-dependent: GPU, display)', which is exactly the inference this branch removes. gpu-test-policy claimed a backend is required on every host we build it for, and that RequiredOn mirrors the gn args. Neither is literally true: the browser build enables Ganesh without ganesh-gl being required there, and Tizen builds Ganesh with no test leg at all. RequiredOn lists test hosts, and now says so. golden-image-tests placed the Vulkan renderers in the Console satellite. The sources are under tests/VulkanTests/ and also build into the platform-restricted SkiaSharp.Vulkan.Tests library that the Android and Windows device hosts register. Also notes that a platform tag need not have goldens yet — tvos and graphite-dawn.browser have none, so their first run fails as unseeded by design.
[Windows] Stop pinning a Windows SDK version by default (#4588) Context: #4588 Context: 7c23c53 Follow-up: #4589 The benchmark-source (windows-latest, Windows, native/windows) leg of Track - Benchmarks died the instant it began the native build: Done. Made 114 targets from 63 files in 358ms Initializing the Visual C++ environment once for amd64. An error occurred when executing task 'libSkiaSharp'. Error: Process 'cmd.exe' failed with error: 1 RunNinjaWithVcVars invoked vcvarsall.bat with the default of the windowsSdkVersion argument, 10.0.22621.0, which matches the AzDO agents. The hosted runner is windows-2025-vs2026 and ships only Windows SDK 10.0.26100.0, and vcvarsall hard-fails on an SDK that is not installed: [ERROR:winsdk.bat] Windows SDK 10.0.22621.0 : 'C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um' not found or was incomplete Nothing needed that default. Before the MSVC environment was initialized explicitly there was no such argument at all: gn resolved win_sdk_version itself and the toolchain interpolated that resolved value into the vcvarsall command it generated, so the version was always one that existed on the machine and the two could never disagree. Hardcoding a constant only meant the build broke wherever that exact SDK was absent - this runner today, and equally a developer box carrying just a newer one. Default the argument to empty and omit it from both gn and vcvarsall when unset, so each detects an SDK that is present. Setting it still pins both together, so --windowsSdkVersion remains available to build against a specific SDK. * drop the `>nul` that hid the failure. It suppressed the vcvarsall banner, but `>nul` redirects only stdout and VsDevCmd writes its errors there too, so it discarded the diagnosis along with the banner - rerunning with `2>nul` still prints the [ERROR:winsdk.bat] lines, while `>nul` yields nothing but the exit code. The banner is five lines per architecture and worth keeping in the log. * this went unnoticed because benchmark-source runs on pull requests only and is skipped on main, so #4570 merged green without the path ever being exercised. * whether the vcvarsall call is needed at all is left open in #4589: every tool is invoked by absolute path and gn emits the SDK include and lib directories as explicit -imsvc and /LIBPATH: flags, so it may be redundant for our LLVM-based configuration. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Copilot App <[email protected]>
Description
The
benchmark-source (windows-latest, Windows, native/windows)leg of Track - Benchmarks dies the instant it starts the native build (failing run):Root cause.
RunNinjaWithVcVars(added in #4570) runs:10.0.22621.0was the default of the--windowsSdkVersionargument, also new in #4570, and it matches what the AzDO agents ship. The GitHub-hosted runner iswindows-2025-vs2026, which ships only Windows SDK10.0.26100.0. vcvarsall hard-fails on an SDK version that isn't installed and returns 1 — and>nulswallowed the reason, which is why the log says nothing at all.Reproduced locally (VS 18, SDKs 22621 + 26100 installed) with the exact generated command line:
>nul10.0.22621.0(installed)10.0.20348.0(not installed)Dropping
>nulreveals it:[ERROR:winsdk.bat] Windows SDK 10.0.20348.0 : '…\include\10.0.20348.0\um' not found or was incomplete.Nothing needed that default. Before #4570 there was no such argument: gn resolved
win_sdk_versionitself (BUILDCONFIG.gn→lowest_version_dir.py) and the toolchain interpolated that same resolved value into the vcvarsall command it generated — so the version was always one that exists on the machine, and the two could never disagree. The same runner image built libSkiaSharp from source successfully an hour before the failure (run 30492110303, job 90712480452 — 33 min of ninja, green). Hardcoding a version just meant the build broke on any machine that didn't happen to have that exact SDK — CI here, and equally a developer box with only a newer one.The fix: default the argument to empty and omit it from both gn and vcvarsall when unset, so each detects an SDK that actually exists. Setting it still pins both — so
--windowsSdkVersion 10.0.26100.0remains available to build against a specific SDK locally, and gn and vcvarsall stay in agreement when you do. Dropping>nulrestores visibility. It was hiding the vcvarsall banner, but>nulredirects only stdout — and VsDevCmd writes its errors there too, so it discarded the diagnosis along with the banner (verified: with2>nulthe[ERROR:winsdk.bat]lines still appear, with>nulnothing does). The banner is five lines per architecture and is worth having in the log; the next failure in here will say why instead of just surfacing an exit code.Why it wasn't caught.
benchmark-sourceisif: github.event_name == 'pull_request'— it is skipped on main (verified on run 30503500442). #4570 merged green without this path ever being exercised, and the failure surfaced on an unrelated PR (#4575, which touches no native files). Worth considering separately whether the native source-build legs should also run on main.Alternatives considered
track-benchmarks.yml. Fixes CI but leaves the same landmine for every other consumer, including local builds on a machine without10.0.22621.0.find_winsdk.py+lowest_version_dir.pyand pass that one value to both. Works, but it reimplements in cake what gn already does for itself, for no gain over simply not passing a version.install-winsdk.ps1exists, but it needs a per-SDK fwlinkLinkIdand adds minutes to every run for an SDK the job has no reason to care about.gn/toolchain/BUILD.gnis invoked by absolute path and every search path is an explicit flag (-imsvc,/LIBPATH:), so it may well be redundant for our LLVM-based config — but proving that needs a real Windows build and is a different change with a different blast radius. Filed as [Windows] Investigate whether the native build still needs the vcvarsall call at all #4589.Related issues
Regression from #4570 ("[Windows] Initialize the MSVC environment once per native build"). #4589 follows up on whether the vcvarsall call is needed at all.
Fixes #
Required skia PR
None.
Areas affected
binding/)externals/skia/src/c,include/c)Changes
None — build-infrastructure only, no public API or managed behavior change.
One build-side behaviour change worth naming:
--windowsSdkVersionno longer defaults to10.0.22621.0. Unset, gn detects the SDK as it did before #4570; set, it pins gn and vcvarsall exactly as before. On the AzDO agents gn's detection returns10.0.22621.0— the same version that was hardcoded — so the compiler flags are expected to be identical; the CI run on this PR is what confirms it.Testing
No unit tests — cake/CI build plumbing with no managed surface. Verified empirically instead:
>nulsurfaced[ERROR:winsdk.bat] Windows SDK … not found or was incomplete.>nulhid the error: rerunning the failing command with2>nul(discarding stderr) still printed[ERROR:winsdk.bat] Windows SDK … not found or was incomplete, proving VsDevCmd writes errors to stdout; with>nulthe same command captured zero lines and exit 1 — exactly the CI symptom.amd64 10.0.26100.0 -vcvars_ver=14.2): both initialize forx64and exit 0, and the chained ninja command runs. Also checked theProcessArgumentBuilderrendering throughSystem.Diagnostics.Processso the nested quotes survivecmd /s.win_sdk_versionis unset:BUILDCONFIG.gndeclares it empty and callslowest_version_dir.py. Ran that script against a realWindows Kits\10\Include— returns10.0.22621.0with 22621 + 26100 installed, i.e. the value that was previously hardcoded.gn/skia/BUILD.gn: includes are emitted as-imsvcflags (or gninclude_dirs) and libs aslib_dirs→/LIBPATH:, all interpolated from gn's$win_sdk_version.--dryrun, both with no argument and with--windowsSdkVersion=10.0.26100.0, confirming the override still plumbs through.Not tested locally: a full libSkiaSharp compile (no depot_tools/skia checkout on this machine) and the macOS/Linux legs (untouched). The two things CI must confirm are the
benchmark-source (windows-latest, …)job — which only runs on pull requests, so this PR is the test — and the AzDO Windows native job proving gn's detection resolves to the SDK that was previously hardcoded.Checklist
Changesabove lists all public API and behavioral changes (or "None.")mono/skiaPR linked above and bindings regenerated — n/a, no C API or submodule change