Skip to content

Detect link tool automatically on Windows, and fallback to lld-link if not found #5771

@stevapple

Description

@stevapple

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

  1. Open a regular CMD or PowerShell window;
  2. Change to the root of any Swift package;
  3. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions