Skip to content

Windows installation instructions on https://www.swift.org/install/windows/ are insufficient if building Swift projects with C++ requiring Windows system headers #1179

@jerryjrchen

Description

@jerryjrchen

Describe the bug

In particular, the winget instructions on the https://www.swift.org/install/windows/ page don’t seem to get all the required files:

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"

I tried building the swift-testing project afterwards, but that failed due to missing dependencies when building cpp source files.

To Reproduce

  1. Setup Windows 11 Pro
  2. Run the winget instructions above
  3. Use the Swift installer to install Swift 6.2
  4. git clone https://github.com/swiftlang/swift-testing.git and run swift test
  5. The build fails with missing system headers

Workaround is to install Visual Studio Pro and include the cpp libraries during setup. I hope there's a way to do this with the community edition as well, although I haven't tried it.

Expected behavior

Project should build and run tests.

Actual behavior

error: 'swift-testing': Invalid manifest (compiled with: ["C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.2.0+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\JERRYJ~1\\AppData\\Local\\Temp\\TemporaryDirectory.QOA2tg\\vfs.yaml", "-L", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.2.0+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Platforms\\6.2.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk\\", "-libc", "MD", "-I", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Platforms\\6.2.0\\Windows.platform\\Developer\\Library\\XCTest-6.2.0\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Platforms\\6.2.0\\Windows.platform\\Developer\\Library\\XCTest-6.2.0\\usr\\lib\\swift\\windows\\aarch64", "-L", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Platforms\\6.2.0\\Windows.platform\\Developer\\Library\\XCTest-6.2.0\\usr\\lib\\swift\\windows\\aarch64", "-I", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Platforms\\6.2.0\\Windows.platform\\Developer\\Library\\Testing-6.2.0\\usr\\lib\\swift\\windows", "-L", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Platforms\\6.2.0\\Windows.platform\\Developer\\Library\\Testing-6.2.0\\usr\\lib\\swift\\windows\\aarch64", "-use-ld=lld", "-swift-version", "6", "-I", "C:\\Users\\jerryjrchen\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.2.0+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "6.2.0", "C:\\Users\\jerryjrchen\\Documents\\swift-testing\\Package.swift", "-o", "C:\\Users\\JERRYJ~1\\AppData\\Local\\Temp\\TemporaryDirectory.9p8moc\\swift-testing-manifest.exe"])
error: link command failed with exit code 1 (use -v to see invocation)
lld-link: error: could not open 'kernel32.lib': no such file or directory
lld-link: error: could not open 'runtimeobject.lib': no such file or directory
lld-link: error: could not open 'ucrt.lib': no such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Environment details

Desktop (please complete the following information):

  • OS: Windows 11 Pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions