build: Windows bootstrapping support#88775
Conversation
compnerd
commented
May 1, 2026
- Explanation: Setup a bootstrapped compiler on Windows
- Scope: Enable a multi-stage bootstrap for Windows to get a compiler able to be used for bootstrapping
- Issues:
- Risk: medium risk; this changes the entire toolchain build on Windows
- Testing:
|
@swift-ci please test Windows platform |
|
@swift-ci please smoke test windows platform |
|
@swift-ci please test windows platform |
ce6e7d1 to
587b830
Compare
|
@swift-ci please test Windows platform |
|
@swift-ci please test Windows platform |
1 similar comment
|
@swift-ci please test Windows platform |
|
@swift-ci please test Windows platform |
67e6ba6 to
c3f6aa1
Compare
|
@swift-ci please test Windows platform |
|
@swift-ci please test Windows platform |
|
@swift-ci please test Windows platform |
|
@swift-ci please smoke test Windows platform |
When CMake configures Android builds, it may auto-detect the NDK clang as the target compiler. Sending that compiler through clang-cache.exe from the staged Windows toolchain can mix LLVM versions. That version skew makes dependency scanning look for builtin headers in the wrong resource directory. Skip the launcher for Android SDK builds while keeping caching for paths that use the staged compiler directly.
The staged compiler table carries MSVC-style clang-cl entries in .C/.CXX and GNU-style clang entries in .GNUC/.GNUCXX. Select the GNU drivers for non-Windows SDK dependencies, compiler-rt, and dispatch so Android builds do not receive MSVC-only flags such as /GS- and /Gw.
Build Android swift-inspect with a target-aware compiler view that exposes the stage1 GNU clang drivers under .C/.CXX. This keeps the NDK clang from seeing MSVC-style flags while still using the stage1 Swift compiler and Android SDK.
Add Set-WindowsManifestDependencies to merge dependency entries into an embedded manifest and re-embed it with mt. This gives later SxS binding steps a shared path for binding tools without replacing unrelated manifest content.
Stage each Swift runtime DLL needed by the laid-out toolchain as a private per-DLL SxS assembly under usr/bin. Compute each EXE's static import graph and write the full Swift runtime closure into the EXE's application manifest. Disable linker-generated DLL manifests for Swift's CMake-built DLLs and for the mimalloc MSBuild project, then validate existing DLL manifest resources before binding: reject UAC execution-level metadata and unexpected reserved RT_MANIFEST resource IDs so implicit linker manifests cannot poison SxS activation. Keep the checked-in WiX authoring canonical and warn when the live import graph drifts from bld/cli/dbg/ide package ownership.
|
@swift-ci please test Windows platform |
|
@swift-ci please test with following PRs: @swift-ci please build toolchain Windows platform |
Build the Stage2 test-time tools needed by check-swift before the final test build. Bind the runtime-loading EXEs to the platform SDK runtime they are tested against. Use the build-host architecture so host-run tools remain runnable when the final toolchain target differs. Keep this separate from the distribution SxS pass because these tools execute from the build tree.
Run the dispatch, XCTest, and llbuild test builds with the Stage1 compiler artifacts instead of the legacy Compilers cache. The swift-format and SourceKit-LSP SwiftPM tests also need SwiftSyntax from the Stage2 compiler build, matching the CMake build rules for those projects. Use the Stage2 host library path there and fix the stale swift-markdown CAtomic include path in the SourceKit-LSP test arguments.
When %host-build-swift builds plugin DLLs on Windows, those DLLs are loaded by the compiler under test. Pass the configured host SDK and resource directory so the plugins link against the runtime that compiler will load instead of the Stage2 stdlib resources.
Allow non-Darwin compiler builds to consume an already-built libdispatch package instead of always creating a nested ExternalProject. When dispatch_DIR is set, import the dispatch package and use it for the host SDK dispatch target. Continue building libdispatch for other non-Darwin target SDKs so cross-compilation still gets target-specific dispatch variants.
Disable dispatch in the Windows bootstrap compiler caches. Stage0 and Stage1 do not build SourceKit or the runtime SDK, so they do not need Swift's Libdispatch.cmake path to configure nested libdispatch ExternalProjects. Keep passing the staged DynamicCDispatch package to the Stage2 compiler build, where SourceKit and tool components still need host dispatch. Drop the Stage0CDispatch build and stop feeding dispatch packages to Stage0 and Stage1.
Runtime clients of swiftCore need the SwiftRT image-registration object on their link lines. On COFF this object supplies pSwiftImageConstructor and the .sw5* section range symbols used to register Swift metadata and conformances for each image. CMake propagates usage requirements when an OBJECT library appears in an INTERFACE_LINK_LIBRARIES chain, but it does not add that object's payload to the final consumer link line. Keep the swiftrt targets in the interface for their usage requirements, and explicitly propagate their object files with TARGET_OBJECTS.
|
@swift-ci please test with following PRs: @swift-ci please build toolchain Windows platform |
|
@swift-ci please test with following PRs: @swift-ci please test Windows platform |
|
Please test with following PRs: @swift-ci please test Windows platform |
|
Please test with following PRs: @swift-ci please build toolchain Windows platform |
|
Please test with following PRs: @swift-ci please smoke test macOS platform |
|
Please test with following PRs: @swift-ci please smoke test Linux platform |
|
Please test with following PRs: @swift-ci please build toolchain Windows platform |
2 similar comments
|
Please test with following PRs: @swift-ci please build toolchain Windows platform |
|
Please test with following PRs: @swift-ci please build toolchain Windows platform |
|
Please test with following PRs: @swift-ci please build toolchain Windows platform |
|
@compnerd Merging this without swiftlang/llvm-project#13046 or swiftlang/llvm-project#13069 broke PR testing for Windows |
That showed up later - the LLDB tests have been painful and constantly regressing as people keep adding new tests with long names. There was a second patch that @adrian-prantl had committed to shorten the names I believe. |