Swift 5.3 and Windows


Since I haven't found any timeline of Swift 5.3 release or Windows compiler release, I would like to ask some questions.

  • Is it reasonable to expect Swift 5.3 (Linux) release before macOS 11 public release?
  • Is it reasonable to expect Swift Windows toolchain being available before the macOS 11 public release? (In the sama manner as the Ubuntu 20.04 toolchain is being available through master snapshot.
  • Is it reasonable to expect the same general functionality on Windows as available on Linux? Speaking about SPM and Sourcekit-lsp?

I have no experience with programming on Windows. Therefore I lack the general overview of how a compiler toolchain might work on Windows and what are the challenges when using the Swift compiler there.

Have a nice day!


Swift 5.3 will almost certainly be released in mid-September, just like every other fall release of the Swift toolchain. I know nothing about the Windows port, but it might help those who would answer to know why you're asking, if you "have no experience with programming on Windows." That would help them figure out where you're coming from and how best to answer and help you.

All previous releases of Swift have become available at the same time on all platforms (excepting a few accidental oversights among the patch releases). So while there has never been an official statement that I know of, it is extremely unlikely that 5.3 will arrive at different times on different platforms.

@compnerd’s VS2019 5.3 pipeline is comparable to those snapshots. Its artifacts include the Windows toolchain and installers. (That link is to an arbitrary build so you can see what you’re aiming for; you’ll want to actually navigate to the corresponding screen from the latest build in the pipeline instead.) Installation instructions are here.

  • The compiler and core libraries (Foundation, Dispatch, XCTest) are at parity with Linux.
  • SwiftPM is incomplete, and not included in the toolchain yet. For now CMake seems to be the way to build on Windows. My current strategy is to generate CMake instructions from the SwiftPM manifest on one of the other platforms, then to check it out on Windows and build it with CMake. (This is the tool I use for that.)
  • I don’t know about SourceKit‐LSP, but from what I understand, it relies heavily on SwiftPM, so it’s probably incomplete as well.
1 Like

that's unfortunate, SPM should be the focus and will be essiential when developping and consuming crossplatform libraries.. imagine using rust without cargo..

if SPM comes, there is no reason to advertise CMake for swift, people will create tutorial on how to get started with Swift on Windows with the wrong mindset (different way to build for each platform) and will give the wrong impression (Windows require specific tools)

i think using CMake with Swift is a HUGE mistake

There was ton of buzz around Swift on Windows announcement, and having to use a extra "unique" tool for Windows already created ton of harm (i personally refuse to touch it, if i use swift already i don't want to use cmake, if i don't use swift yet, i have to learn cmake, wich adds useless complexity to get started), on top of that it's still not on that page https://swift.org/download/#snapshots


I assume that Swift for Windows will appear on swift.org when the whole toolchain including the SPM is ready.

Even though I like SPM, lack of full featured SPM from the start is not a dealbreaker for me (for my use case). The SPM is great (on Linux) but when it comes to the Xcode, I find myself generating xcodeproject all of the time.

My use case (as asked by @RUSshy) is not to develop on Windows myself, but rather learn to setup an environment. I was getting some of my friends into Swift. Unlike me, they use mainly Windows. Linux virtualization in Vbox failed my expectations and dual boot lacks the convenience.

For my use case, getting the sourcekit-lsp to work (even if the way to do so is a crooked one) is far more important. I think that learning Swift which relies heavily on inference and omitting without Sourcekit is ... a tough experience.

I agree with you.

No one is actively discouraging SwiftPM for Windows. It’s just that no one has had the time to finish it yet. CMake support for Swift was needed first in order to get the standard and core libraries building for Windows. Those libraries were in turn necessary before work could start on SwiftPM. At the moment, near the end of the process, CMake works and SwiftPM doesn’t.

My description was of where we are, not of where we want to be.


I’m not so confident in the release of Windows toolchain. If you have tried the current one, you may notice that besides the lack of SwiftPM, swiftc needs additional parameters to work with the SDK and other stuffs, which is definitely a big reason why CMake is necessary. Also, the REPL is broken.

That’s not Swift!! Every active Swift developer knows that Swift is out of the box on at least all the officially supported platforms. I would feel pity if the introduction of Windows toolchain breaks the law. If it needs to, the Windows toolchain should be marked as “experimental” or “alpha”.

1 Like

I use it almost every day. I know how well it does and doesn’t work.

Yes, this is still annoying, but there are significantly fewer “patch flags” than you needed a few months earlier. With time, they are evaporating.

If you only plan on working with the host SDK, then I’m reasonably certain you can just install the contents of the SDK’s usr directory inside the toolchain’s usr directory. Once you’ve done that, I don’t think any more flags will be necessary. (But I haven’t tried it.) Mostly the extra flags aren’t directly Windows related, so much as a product of the toolchain‐SDK split, which is necessary to support cross‐compilation, such as Windows to Android (you’ll need the toolchain) or Linux to Windows (you’ll need the SDK).

There is reason it isn’t available from the main downloads page. No one claims it is release‐worthy yet.


Readers of this thread may be interested to know that SwiftPM can cross‐compile to Windows out of WSL. I have already begun shifting the my CI scripts to this method, and there are more details in this thread. It is still more complicated than a native SwiftPM build, but it is significantly less complicated than setting up CMake. Since SwiftPM is what builds SwiftPM, it should also make it much easier to contribute its native Windows port if anyone is interested.


I think that SPM was pretty good in development at least as of August 2019, but I haven't read much. Either way, I think it's likely that SPM will be available in the final release of Swift for Windows.

1 Like

that would be another mistake to not have SPM ready for 5.3 official release
again, i know it's "community effort" but let's not forget what is important, "windows support" just on paper or a real strategy to bring swift on windows

if the end goal is just to be able to compile Tensorflow with Swift on windows, then yeah, i guess not porting everything make sense, but hey, i'm just curious

again i'd be down to put some little money to help, since i'm clueless about 99% of the work needed to do all that stuff

but please let's be clear about expectations and goals

From today, the VS 2019 pipeline builds on Azure CI (hosted by @compnerd) will include SPM (the first one is #20200907.3). I think all of you looking forward to it can now have a try with ease🎉

P.S. Personally, I’m expecting it in release 5.3, but SPM was not included (and perhaps not ready) in the 5.3 builds yet.


I tried the latest snapshot

C:\dev\ark_swift>swift run
error: unable to invoke subcommand: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-run.exe ()

i installed using the installer.exe file

is there something else to do?

EDIT: yes i followed https://github.com/compnerd/swift-build/blob/master/docs/GettingStartedWindows.md

Maybe you should try swift-run, the shim may be broken on Windows.

Also, both SPM and swiftc still needs additional flags to work so far. I’ve requested a documentation of this in compnerd/swift-build#284, wait and see the progress.

1 Like
Terms of Service

Privacy Policy

Cookie Policy