Skip to content

Windows: no way to work around MSVC 14.51 STL ↔ Clang 19 mismatch (windows-2025 + Swift 6.1/6.2) #119

Description

@leogdion

Problem

On the windows-2025 runner, building with Swift 6.1 or 6.2 fails inside swift-crypto's CCryptoBoringSSL:

yvals_core.h:917:1: error: static assertion failed:
error STL1000: Unexpected compiler version, expected Clang 20 or newer.

Root cause is environmental, not a consumer-package bug:

  • The windows-2025 image now exposes a newer MSVC 14.51 toolset (VS18). The Swift/clang driver resolves the newest installed Visual Studio via vswhere, so it picks 14.51, whose STL (yvals_core.h) hard-asserts Clang 20 or newer.
  • Swift 6.1 and 6.2 bundle Clang 19 → assertion fires. Swift 6.3 bundles Clang 20 and is fine.
  • windows-2022 still defaults to an older 14.4x toolset compatible with Clang 19, so it builds all three.

Because the Windows build is delegated entirely to this action (gha-setup-swift + swift build), a consumer has no lever to work around it — the action exposes only windows-swift-version / windows-swift-build. There's no windows-swift-flags (unlike wasm-swift-flags / android-swift-build-flags) and no toolset selection, so neither of the two known mitigations can be applied through the action.

Impact

Every package using brightdigit/swift-build@v1 with a [windows-2022, windows-2025] × [6.1, 6.2, 6.3] matrix hits this identically. Today the only fix a consumer can apply is at the matrix level — dropping windows-2025 × {6.1, 6.2} (e.g. brightdigit/MistKit#418) — which loses windows-2025 coverage for those toolchains.

Requested: give consumers a workaround knob

Any one of these would unblock callers who want to keep windows-2025 coverage:

  1. windows-swift-flags input (mirrors wasm-swift-flags / android-swift-build-flags) appended to the Windows swift build/swift test. Callers could then pass:

    windows-swift-flags: -Xcc -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
    

    This silences the STL static_assert. Caveat: it pairs Clang 19 codegen with a 14.51 STL, so it's a bypass, not a true fix — see [Windows] Consider passing -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH to Clang by default swiftlang/swift#79709.

  2. MSVC toolset pin input (e.g. windows-vc-toolset: "14.44"): before the build, activate VS2022's older 14.44 toolset (set INCLUDE/LIB/PATH/VCToolsInstallDir, or write Microsoft.VCToolsVersion.default.txt) so the Swift driver uses a Clang-19-compatible STL. 14.44 ships on the windows-2025 image (VS2022 17.14) alongside 14.51.

  3. Auto-mitigation + docs: detect the Swift toolchain's bundled Clang major vs. the default MSVC STL's required Clang, and either auto-select a compatible installed toolset or emit a clear, documented error pointing at options 1/2. At minimum, document the matrix-exclude workaround.

Option 1 is the smallest change and matches the existing per-platform *-swift-flags pattern; option 2 keeps codegen/STL aligned but is more involved.

References

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions