swiftlang / swift-org-website

Swift.org website
https://swift.org
Other
477 stars 187 forks source link

Windows installation instruction using WinGet does not install all required dependencies #839

Closed bkhouri closed 3 weeks ago

bkhouri commented 1 month ago

Describe the bug

The instructions on Installation via Windows Package Manager does not install all required dependencies.

To Reproduce

Steps to reproduce the behaviour:

  1. Follow the step outlined on https://www.swift.org/install/windows/winget/ to install Swift on Windows using winget. A screenshot of the instructions can be found below.
  2. Open Visual Studio 2022
  3. Open Visual Studio 2022 built-in terminal
  4. run the following
    mkdir mySwiftPackage
    cd mytest
    swift package init
    swift build

At the time of writing this issue, the page content is:

Screenshot 2024-10-29 at 10 46 28 AM

Expected behavior

The swift build is successful, so either:

Actual behavior

The build is unsuccessful as some dependencies do not appear to be installed.

PS C:\Users\bkhouri\Documents\git_win\sample_proj> swift build
error: 'sample_proj': Invalid manifest (compiled with: ["C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\bkhouri\\AppData\\Local\\Temp\\TemporaryDirectory.97ZPCH\\vfs.yaml", "-L", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\SDKs\\Windows.sdk\\", "-libc", "MD", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-L", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows", "-L", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows\\aarch64", "-use-ld=lld", "-swift-version", "6", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "6.0.0", "C:\\Users\\bkhouri\\Documents\\git_win\\sample_proj\\Package.swift", "-o", "C:\\Users\\bkhouri\\AppData\\Local\\Temp\\TemporaryDirectory.ZrF1QN\\sample_proj-manifest.exe"])
error: link command failed with exit code 1 (use -v to see invocation)
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
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: 'sample_proj': Invalid manifest (compiled with: ["C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\bkhouri\\AppData\\Local\\Temp\\TemporaryDirectory.pQzFha\\vfs.yaml", "-L", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\SDKs\\Windows.sdk\\", "-libc", "MD", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-L", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows", "-L", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.2\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows\\aarch64", "-use-ld=lld", "-swift-version", "6", "-I", "C:\\Users\\bkhouri\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.2+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "6.0.0", "C:\\Users\\bkhouri\\Documents\\git_win\\sample_proj\\Package.swift", "-o", "C:\\Users\\bkhouri\\AppData\\Local\\Temp\\TemporaryDirectory.e6uuwx\\sample_proj-manifest.exe"])
error: link command failed with exit code 1 (use -v to see invocation)
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
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Screenshots

Screenshot 2024-10-29 at 10 52 35 AM

Environment details

Desktop

Smartphone

N/A

If possible, minimal yet complete reproducer code (or link to code)

See "Steps to Reproduce" above

Swift.org version/commit hash

Access https://www.swift.org on Tuesday October 29 at 11:00AM ET (it's as close of a version/commit I can get :) )

Additional context

Adding one of these solved the issue.

The default steps installed MSCV X86_64 toolchain, while I was running Windows on ARM. Adding the following components allows the build the succeed.

Screenshot 2024-10-30 at 8 41 56 AM
dschaefer2 commented 1 month ago

I've seen those errors when building with the Swift ARM toolchain without the MSVC ARM toolchains being installed.

compnerd commented 3 weeks ago

The piece that was missing is --add Microsoft.VisualStudio.Component.VC.Tools.ARM64. I'm fine with adding that to the instructions, but then people might complain about installing "unnecessary" components, but this seems reasonable for enabling cross-compilation.

shahmishal commented 3 weeks ago

@compnerd or @bkhouri can you create a PR to update the instructions on the install page?