Swift not found

Installed Swift with exe installer, installed Visual Studio support libraries and set path with:

setx PATH "$Env:PATH;%LocalAppData%\Programs\Swift\Toolchains\6.1.2+Asserts\usr\bin"

but Swift still is not available, swift -version returns nothing:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\purpln> swift.exe -version
PS C:\Users\purpln> where.exe swift
C:\Users\purpln\AppData\Local\Programs\Swift\Toolchains\6.1.2+Asserts\usr\bin\swift.exe
PS C:\Users\purpln> C:\Users\purpln\AppData\Local\Programs\Swift\Toolchains\6.1.2+Asserts\usr\bin\swift.exe -version
PS C:\Users\purpln> swift -version
PS C:\Users\purpln>

libraries installed:

MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (v14.44-17.14)
MSVC v143 - VS 2022 C++ x64/x86 build tools (v1444-17.14)
Windows 11 SDK (10.0.26100.3916)

I would recommend not using PowerShell, particularly to ensure that things are working. Once the installer runs, starting a new CMD shell should have swift in the path (where swift should find the path). If that doesn't, then the installer is silently failing. The logs should help shed light on what is failing.

Also, please provide more information about where you are running this. Is this ARM64 or X64?

Thanks for your response,
Windows 11 arm64.
Tried to use Swift from CMD got these errors:

The code execution cannot proceed because <library>.dll was not found. Reinstalling the program may fix this problem.

where <library> are swiftCore, swiftWinSDK, swiftDispatch, swiftCRT

After specifying:

setx PATH "$Env:PATH;%LocalAppData%\Programs\Swift\Runtimes\6.1.2\usr\bin"

PowerShell Swift started to responding on swift -version, CMD - doesn't.
Still fails on building. Compiles SwiftPM successfully, but there are errors on linking:

lld-link: error: could not open 'msvcrt.lib': no such file or directory
lld-link: error: could not open 'oldnames.lib': no such file or directory
lld-link: error: could not open 'msvcprt.lib': no such file or directory

How to get logs from Swift installer?

When you run the installer, you can pass /lv*x to get verbose logs.

However, if you are running on ARM64, there might be some issues with the official releases. I would cross check the behaviour if you use a recent release from GitHub - thebrowsercompany/swift-build: Swift toolchain builds by The Browser Company.

Tried to use swift on windows one more time. Did not understand where to pass /lv*x in UI installer.

Documented all steps that was made at my recent attempt:

  1. installed fresh tiny11 Windows ARM64 VM to Parallels Desktop;
  2. in VM installed GIT for arm from official website:
    • every setting is default enabled only symbolic links at last step;
  3. installed Visual Studio Community edition from official website with:
    • MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (v14.44-17.14)
    • MSVC v143 - VS 2022 C++ x64/x86 build tools (v1444-17.14)
    • Windows 11 SDK (10.0.26100.6584)
  4. installed Swift 6.2 release with swift exe installer from swift.org;

Difference from the previous try:

  • swift command was found immediately, was no need to setup setx PATH;
  • swift command works in both CMD and PowerShell;
  • swift -version outputs succesfully;

But still getting same error on swift run command:

lld-link: error: could not open 'msvcrt.lib': no such file or directory
lld-link: error: could not open 'oldnames.lib': no such file or directory
lld-link: error: could not open 'msvcprt.lib': no such file or directory

Immediate update - just added C++ CMake tools for Windows to Visual Studio components and everything started working fine except unable to create symbolic link at warning. But this is not vital problem. I don't have For Developers option in Windows settings, maybe I would need to dig into some registers to enable symbolic links.

For "most" development with Swift, you do not need symbolic links, you then just get the mentioned warning and you have to look a little bit deeper inside the .build folder for the products (the convenient .build\release and .build\debug folders will not be there).

For how to enable the development mode see there, in fact what you want is the SeCreateSymbolicLinkPrivilege to enable symbolic links (test via mklink newfile oldfile , creating a symbolic link file named newfile pointing to oldfile).

That does indicate that that the C++ components are required. The CMake tools happen to just pull in the same components. If there is something there that could be made clearer, a PR to improve that would be appreciated.

The „should“ on that page sounds like something optional, but it isn‘t. The more precise (albeit unfriendlier) word would be „must“, but then it should be added if it must be precisely the listed versions, so I think the text change should be done by someone who really knows…