Skip to content

Support Windows ARM64#2797

Open
abdnh wants to merge 15 commits intobeeware:mainfrom
ankitects:windows-arm
Open

Support Windows ARM64#2797
abdnh wants to merge 15 commits intobeeware:mainfrom
ankitects:windows-arm

Conversation

@abdnh
Copy link
Copy Markdown

@abdnh abdnh commented Apr 13, 2026

This adds support for Windows ARM64.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@abdnh abdnh marked this pull request as ready for review April 13, 2026 12:05
@abdnh
Copy link
Copy Markdown
Author

abdnh commented Apr 13, 2026

(Windows tests failing because the stub binary URL has changed to include a platform suffix)

Copy link
Copy Markdown
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broadly, this looks great - a couple of minor details flagged inline, mostly around naming (similar naming issues to the template), and property vs method use.

Comment thread src/briefcase/platforms/windows/__init__.py
Comment thread src/briefcase/platforms/windows/__init__.py Outdated
Comment thread src/briefcase/platforms/windows/app.py
@freakboy3742
Copy link
Copy Markdown
Member

I've done some initial testing of this, in conjunction with the updated Visual Studio template.

I got a VSStudio project to build, but I needed to:

  • update the Visual Studio project to use the latest build tools (v145, rather than v143). That's probably a good idea regardless, so that a fresh install of Visual Studio 2026 is easier.
  • Re-install Python to make sure that I had an ARM64 build, rather than an AMD64 build. py install -3.13 installs a AMD64 build by default, for the same reason that uv does.

Even with that, I get an error launching a Toga app because it can't load _cffi_backend. I haven't gotten to the bottom of this; it might be a Python.net issue.

@abdnh
Copy link
Copy Markdown
Author

abdnh commented Apr 14, 2026

Regarding build tools, I've not updated the version because the GitHub runner still uses Visual Studio 2022. This will apparently change next month, but I'm not sure if the ARM runner will be updated at the same time: actions/partner-runner-images#150

@abdnh
Copy link
Copy Markdown
Author

abdnh commented Apr 14, 2026

Even with that, I get an error launching a Toga app because it can't load _cffi_backend. I haven't gotten to the bottom of this; it might be a Python.net issue.

Yes, looks like a Python.net issue. I had a look and was able to modify pythonnet/clr-loader to build ARM64 DLLs but the app then failed with this:

AttributeError: function/symbol 'pyclr_initialize' not found in library '\app_packages\clr_loader\ffi\dlls\arm64\ClrLoader.dll': error 0x7f. Did you mean: 'pyclr_finalize'?

No luck figuring it out so far. Let me know if you think we should add an error if the Toga bootstrap is used for now.

@freakboy3742
Copy link
Copy Markdown
Member

freakboy3742 commented Apr 16, 2026

I've found the source of the problem; the issue is that .NET Framework 4.x doesn't provide ARM64 builds, even though it's installed by default on Windows on ARM machine. You have to use .NET Core 8 (or newer) on an ARM64 machine, or use an x86-64 interpreter running in emulation mode.

See beeware/toga#2782 (comment) for details; I've just pushed beeware/toga#4331 that adds ARM64 support to Toga's Winforms backend.

Copy link
Copy Markdown
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for those updates. I've flagged some cosmetic details, plus one edge case with Python 3.10 and 3.11 that we'll need to handle.

We should also update the VSCode install instructions to remove the reference to VSCode 2022 (since 2026 is what you can download now), and include a reference to needing MSVS v143 VS 2022 C++ ARM64/x64 build tools.

The only other question left is exactly how to land the PR with the other dependencies. I've merged the Visual Studio template, but I can't automate tagging new binaries until we merge this PR; but this PR can't be merged until CI passes, and that won't happen until there's a Toga version that has ARM support. Obviously we'll need to test some pieces manually and add automated CI checks afterwards to break the stalemate; but I need to work out what sequence will be best for that.

):
raise UnsupportedHostError(
"The Python interpreter that is being used to run Briefcase has been "
"compiled for x86_64, and is running in emulation mode on ARM64"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"compiled for x86_64, and is running in emulation mode on ARM64"
"compiled for x86_64, and is running in emulation mode on ARM64 "

Comment thread changes/1887.feature.md
@@ -0,0 +1 @@
Windows on ARM64 is now supported.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Windows on ARM64 is now supported.
Briefcase can now build Windows apps for ARM64 devices.

# build machine.
if self.tools.host_arch != "AMD64":
if (
self.tools.host_arch == "ARM64"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an edge case here that I (re)-discovered in testing: if you're on Python 3.10 or 3.11, platform.machine() returns the architecture of the executing binary, not the underlying machine architecture.

Since host_arch underpins a lot of this logic (and host_arch is populated by platform.machine()), we will need to add some extra logic to "correct" host_arch on Py < 3.12 on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Windows on ARM

2 participants