Repository navigation
Windows CI: building natively on windows-11-arm past MAX_PATH, the Swift runtime, and rules_swift's proto actions - #230
Merged
Conversation
…ift runtime, and rules_swift's proto actions container-windows failed on its first run (LNK1181). What it took, found on the runner by probing and by its runs: - MSVC's lib.exe and link.exe can't open a path past 260 characters even with LongPathsEnabled=1 (a probe on windows-11-arm: HostX64 and HostARM64 alike failed at 283; LLVM's llvm-lib opened it), and Bazel's object paths for swift-syntax's and swift-protobuf's exec-tool archives reach 283 from C:/b/<hash>/execroot/_main. Shortening can't fit them. LLVM's whole toolchain (USE_CLANG_CL) failed: rules_swift's tools pass clang-cl -fno-split-cold-code, and its ARM64 backend fails on upb's code. So C:\v mirrors Visual Studio by junctions but for Tools\MSVC\<version>\bin\HostX64\arm64, copied with lib.exe replaced by llvm-lib, and BAZEL_VC points there. - The Swift runtime's folder (Runtimes\<version>\usr\bin) is put on PATH: the arm64 installer doesn't always. - rules_swift's proto/swift_proto_compiler.bzl runs protoc with no environment (protoc-gen-swift then finds no runtime: 0xC0000135) and runs copy_swift_sources.sh as an executable, which Windows can't start (error 193). The build's copy of rules_swift (--override_repository) gets both the default shell environment and the script run by the shell; an upstream fix for rules_swift to take. - A failed build lists what protoc-gen-swift loads and whether PATH has it.
…r Windows swift.org's Swift for Windows is an assertions build (6.4.2+Asserts), whose SIL verifiers run on every compile, unlike Linux's and the Mac's. One stopped the SwiftUI module: "SIL memory lifetime failure" in _GuideOffset's init (memory is initialized, but shouldn't be). CI's Windows build passes -sil-verify-none to the target's and the exec tools' compiles; the finding is reported apart.
The Windows Storybook now builds; its headful build stopped in SwiftNIO's C (CNIOAtomics: C11 atomics; CNIOWindows.h: __attribute__), which needs clang, as SwiftPM compiles a package's C on Windows. clang-cl for everything fails (rules_swift's tools pass it -Xclang=-fno-split-cold-code, and its ARM64 backend fails on protobuf's upb), so the target platform is the host with rules_cc's clang-cl constraint (@isomer//tools/windows: windows_arm64_clang_cl), and clang_cl_for_targets, rules_cc's clang-cl toolchain asking that constraint of the target rather than of the execution platform, takes the target's C alone. BAZEL_LLVM names Visual Studio's LLVM.
…s_cc's clang-cl reports aarch64-pc-windows-msvc, the SDK's modules are aarch64-unknown-windows-msvc's)
…n the host (Bazel 9's default test toolchain found no execution platform for the clang-cl target platform)
…'s in rules_swift's Windows toolchain, its DLLs on PATH (the headful test's import Testing)
AttilaTheFun
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow-up to #226.
container-windows(not a required check) failed on its first run with LNK1181. This changestools/ci/windows_build.ps1, with comments in two BUILD files and no workflow change. It supersedes #227, which closed when #226's branch was deleted.container-windowspassed on run 43925426116 (head 54ea57d): the Windows Storybook and the headful Storybook test, built natively on windows-11-arm.What the runner showed, and what changed:
lib.exeandlink.execan't open them even withLongPathsEnabled=1; HostX64 and HostARM64 both fail at 283 characters, while LLVM'sllvm-libopens them. Bazel's archive inputs for swift-syntax and swift-protobuf, built for the exec configuration, reach 283 fromC:/b/<hash>/execroot/_main, and no shorter output base fits them. SoC:\vmirrors Visual Studio, withllvm-libas its arm64lib.exe, andBAZEL_VCpoints there.USE_CLANG_CL) for both fails: rules_swift's tools pass clang-cl-fno-split-cold-code, and its ARM64 backend fails on upb's code. The target side alone builds (SwiftNIO's C compiles with warnings about unknown flags only).aarch64-pc-windows-msvcfrom it, for which the SDK has noSwiftmodule.--define=CC_TARGET_TRIPLE=aarch64-unknown-windows-msvcon build and test.--@bazel_tools//tools/test:incompatible_use_default_test_toolchain=false, aswindows_tests_on_linuxin examples/.bazelrc already has.Runtimes\<version>\usr\bin), and Swift Testing's (Library\Testing-<version>\usr\bin).--override_repository, anchored edits that fail loudly if upstream moves):proto/swift_proto_compiler.bzlruns protoc with no environment, soprotoc-gen-swiftends with 0xC0000135 (a DLL not found): both actions get the default shell environment.copy_swift_sources.shas an executable, which Windows can't start (error 193): the script runs through the shell.--descriptor_set_inwith:, which protoc on Windows splits on;: joined with;there.swift/toolchains/swift_toolchain.bzlgives XCTest an-Iand a-LIBPATHunderLibrary\XCTest-<version>, and Swift Testing, beside it, nothing (no such module 'Testing'): the same two forLibrary\Testing-<version>.