Description
In Swift 5.7, we can use SwiftPM in regular CMD or PowerShell environment, but after #5720 we're getting error: toolchain is invalid: could not find link. This is not desirable, and we should both try to detect link and fallback to lld-link if link can't be found.
Expected behavior
SwiftPM could work without special developer environment.
Actual behavior
It just throws error: toolchain is invalid: could not find link.
Steps to reproduce
- Open a regular CMD or PowerShell window;
- Change to the root of any Swift package;
- Run
swift build.
Swift Package Manager version/commit hash
e1e80d7024d0a2c62dee37841d242de7560cfd75
Swift & OS version (output of swift --version && uname -a)
swift.org Swift version 5.8-dev (LLVM efc29aad7a9faa8, Swift f926816e5105fca)
Target: x86_64-unknown-windows-msvc
Windows 10 Pro Workstation 21H1
Visual Studio 17.3.4