Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift on Windows from Winget is apparently too old for Visual Studio #79439

Open
Lukasa opened this issue Feb 17, 2025 · 10 comments
Open

Swift on Windows from Winget is apparently too old for Visual Studio #79439

Lukasa opened this issue Feb 17, 2025 · 10 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Feb 17, 2025

Description

After installing Swift via Winget, I attempted to build swift-crypto. The build immediately failed, complaining clang was too old.

In file included from C:\Users\lukas\Documents\Swift\swift-crypto\Sources\CCryptoBoringSSL\crypto\x509\x_val.cc:59:
In file included from C:\Users\lukas\Documents\Swift\swift-crypto\Sources\CCryptoBoringSSL\include\CCryptoBoringSSL_asn1t.h:60:
In file included from C:\Users\lukas\Documents\Swift\swift-crypto\Sources\CCryptoBoringSSL\include/CCryptoBoringSSL_asn1.h:61:
In file included from C:\Users\lukas\Documents\Swift\swift-crypto\Sources\CCryptoBoringSSL\include/CCryptoBoringSSL_base.h:446:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\memory:8:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\yvals_core.h:927:1: error: static assertion failed: error STL1000: Unexpected compiler version, expected Clang 18.0.0 or newer.
  927 | _EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 18.0.0 or newer.");
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\yvals_core.h:536:58: note: expanded from macro '_EMIT_STL_ERROR'
  536 | #define _EMIT_STL_ERROR(NUMBER, MESSAGE)   static_assert(false, "error " #NUMBER ": " MESSAGE)
      |                                                          ^~~~~
[0/364] Compiling CCryptoBoringSSL crypto\x509\x_val.cc
error: fatalError

Reproduction

  1. winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22000 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
  2. winget install --id Swift.Toolchain -e
  3. git clone https://github.com/apple/swift-crypto
  4. cd swift-crypto
  5. swift test

Expected behavior

The tests to build and run, or some kind of Swift error, or any meaningful progress on the Swift side of things.

Environment

Swift version 6.0.2 (swift-6.0.2-RELEASE)
Target: x86_64-unknown-windows-msvc

Additional information

No response

@Lukasa Lukasa added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Feb 17, 2025
@compnerd
Copy link
Member

This is expected - we need a newer clang distribution which requires a rebranch. I believe that the main snapshot might be new enough.

CC: @shahmishal @etcwilde

@dschaefer2
Copy link
Member

Hmm, I have this config and it works fine. Let me dig a bit more.

@dschaefer2
Copy link
Member

Yeah, I just tried it and it's working (you have 27 tests that are failing mind you :)).

I use the Visual Studio Installer to install the C++ environment and to make sure both the x86_64 and arm64 MSVC toolchains are installed. It's also useful to run it once in a while for updates.

Though you seem to have the latest MSVC - 14.43, so I'm very confused why you're seeing this.

@Lukasa
Copy link
Contributor Author

Lukasa commented Feb 19, 2025

Yeah, the failing tests are why I was trying to do this. Did you try this with winget or with out-of-band toolchain installs?

@dschaefer2
Copy link
Member

No, I just have the latest Community 2022 and then installed the 6.0.2 swift package to match what you had.

One important thing is that you can only have one swift toolchain installed at a time. If you have multiple the path turns into a mess.

@dschaefer2
Copy link
Member

It should match what Winget gives you since all it does is run the same installers. I'm just wondering if you still have an old toolchain lying around getting in the way.

@compnerd compnerd changed the title Swift on Windows from Winget is apparently too old for VSCode Swift on Windows from Winget is apparently too old for Visual Studio Feb 20, 2025
@dschaefer2
Copy link
Member

Oh interesting, on my Parallels VM, I am seeing this. It was working fine on my x86 real machine.

@dschaefer2
Copy link
Member

Now I'm seeing it there too. I'm not sure how it was working before now.

@dschaefer2
Copy link
Member

Sorry about that, I must have been mixing up my environments. Good news is that the 6.1 snapshots are working. They move up to clang 19 by the looks of it.

@gregcotten
Copy link

gregcotten commented Feb 26, 2025

Came here to see if anyone was having this issue too. Clean Windows 11 install, Visual Studio Community 2022 17.13 (MSVC build tools 14.43 / latest). Swift 6.0.3 (and before) just don't work due to this issue.

I discovered you can download the VisualStudioSetup.exe from https://visualstudio.microsoft.com/ (Community installer), and run this to get an older version, which they disclose absolutely nowhere:

.\VisualStudioSetup.exe --channelUri https://aka.ms/vs/17/release.LTSC.17.12/channel

If you want to stick with VS 17.13, you can use older MSVC build tools by going to the "Visual Studio Installer" app, click modify on the install, click "Individual Components", uncheck MSVC build tools latest (on the right side) and select an older MSVC from the list such as 14.42, which seems to work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

4 participants