Error using swift 6.0.1 on Windows 11, ARM, running as a VM on a MacBook Pro m1

I have ventured to experiment with swift 6.0.1 on a Windows 11 (ARM) vm that runs in a Mac Book Pro M1 chip.
I have followed the simple install instructions using either manual config or winget cli.

And I can't get "swift build" on a simple hello world.

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\cdeda> cd C:\Users\cdeda\Developer\hello_world
PS C:\Users\cdeda\Developer\hello_world> swift build
error: 'hello_world': Invalid manifest (compiled with: ["C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.1+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\cdeda\\AppData\\Local\\Temp\\TemporaryDirectory.uNpAeu\\vfs.yaml", "-L", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.1+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\SDKs\\Windows.sdk\\", "-libc", "MD", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-L", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows", "-L", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows\\aarch64", "-use-ld=lld", "-swift-version", "6", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.1+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "6.0.0", "C:\\Users\\cdeda\\Developer\\hello_world\\Package.swift", "-o", "C:\\Users\\cdeda\\AppData\\Local\\Temp\\TemporaryDirectory.0L7Xlo\\hello_world-manifest.exe"])
<module-includes>:1:10: note: in file included from <module-includes>:1:
 1 | #include "AssertionReporting.h"
   |          `- note: in file included from <module-includes>:1:
 2 | #include "CoreFoundationShims.h"
 3 | #include "EmbeddedShims.h"

1 Like

Tweaked the installed VS packages a bit and get a new error

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\cdeda> cd C:\Users\cdeda\Developer\hello_world
PS C:\Users\cdeda\Developer\hello_world> swift build
error: 'hello_world': Invalid manifest (compiled with: ["C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.1+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\cdeda\\AppData\\Local\\Temp\\TemporaryDirectory.UHQwlF\\vfs.yaml", "-L", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.1+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\SDKs\\Windows.sdk\\", "-libc", "MD", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-L", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows", "-L", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Platforms\\6.0.1\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows\\aarch64", "-use-ld=lld", "-swift-version", "6", "-I", "C:\\Users\\cdeda\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.0.1+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "6.0.0", "C:\\Users\\cdeda\\Developer\\hello_world\\Package.swift", "-o", "C:\\Users\\cdeda\\AppData\\Local\\Temp\\TemporaryDirectory.Hzsbto\\hello_world-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)

Screenshot 2024-10-04 at 2.32.29 PM

To be honest, I don't know much about Windows 11 (ARM) and wonder where did you get Swift toolchain for it (or is it able to run x86_64 binaries?). Aside from the ARM specifics, I suggest the following:

You don't need Windows 10 SDK. Windows 11 SDK is the only one you need. Applications created with it will work under Windows 10 too. The recommended version of Windows 11 SDK at the moment is 10.0.22621 (component name Microsoft.VisualStudio.Component.Windows11SDK.22621), see here.

I have a related issue, swift will complain that it can't find the standard library when I try to install it in a Windows 11 arm virtual machine.

Works on my x86_64 PC though (real hardware).

I suspect at this time there are 3 engineers wanting to experiment with Swift on Windows ARM :slight_smile:

The main reason for pushing ARM is the screaming fast apple silicon, it makes this MBP intel (2019) look like a pentium.

I suspect that the reason that you get that error is because you are installing the x64 toolchain image and running under emulation rather than installing the ARM64 toolchain.

Good nudge. I'm by no means a windows expert.
After tripple checking the ingredients. I'm compiling and running using swift cli.

This is amazing.
Thank you swift team.
It feels like OpenStep on windows, 1994.

Here is what you need to have swift 6.0.1 work on Windows ARM under virtualization on Mac M1.
These assume a fresh VM, with no pre-existing dev tools.

  1. Make sure to have the latest VisualStudio Community ARM installed.
  2. Make sure to install the required VS swift components for ARM.
    Windows 11 SDK (10.0.261000)
    MSVC v143 VS 2022 C++ ARM64/ARM64EC build tools (latest)
  3. Make sure to install the swift ARM tool chain.
    swift --version
    Swift version 6.0.1 (swift-6.0.1-RELEASE)
    Target: aarch64-unknown-windows-msvc

Enjoy.

2 Likes

The only know bug I know using swift 6.0.1 official is the

warning: unable to create symbolic link at ...

Enabling developer mode is required (or you can use a GPO to grant yourself the SeCreateSymbolicLinkPrivelege privilege). This isn’t really a bug but a security restriction on windows.

Developer mode is on.

Anyway there is the bugreport from Oct 5: Swift toolchain does not work with target aarch64-unknown-windows-msvc · Issue #76881 · swiftlang/swift · GitHub

The devopler mode might not be enough if the SeCreateSymbolicLinkPrivilege is suppressed by other controls, which might be the case in corporate environments, test via mklink newfile oldfile , creating a symbolic link file named newfile pointing to oldfile.

Works. But that was never my issue anyway. See my bug report.

I suspect that the swift toolchain installed via winget is an x64 toolchain, as opposed to a native arm64 toolchain. I'd recommend installing https://download.swift.org/swift-6.0.3-release/windows10-arm64/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10-arm64.exe from swift.org.

1 Like