Repository navigation
[Windows Arm64] Update tool to target Arm64 on Arm64 hosts #129807
Description
Activity
- addedplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallya: desktopRunning on desktopRunning on desktopP3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectplatform-host-armBuilding on an ARM-based platformBuilding on an ARM-based platformplatform-target-armTargeting an ARM-based platformTargeting an ARM-based platformtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
on Jun 30, 2023 - changed the title
[-][Windows Arm64] Update tool to target Arm64 on Arm64 machines[/-][+][Windows Arm64] Update tool to target Arm64 on Arm64 hosts[/+]on Jun 30, 2023 One this work lands, we should clean up the packages repo tooling:
@loic-sharma Please give me a ping when you want to land this, so that we can ensure the native assets support added in #134203 works for Windows arm64 as well. (Or if you land it earlier than that PR, I'll give you a ping on how to test the native assets on Arm64 Windows.)
Reacted by Loïc Sharma@pbo-linaro is the contributor working on adding Windows Arm64 support.
@dcharkes It looks like the native assets support added by #134203 works already on Windows Arm64 machines thanks to x64 emulation. FYI we're still working on running tests on Windows Arm64 machines, your new tests won't run on Arm64 machines yet.
@pbo-linaro, Daco is working on adding "native assets", which is a new way to support native code in pub packages. From my understanding, this will be an alternative to Flutter's existing support for native plugins. The package author creates a
build.dartfile that uses the user's installed compilers to compile the native assets. For more information, see:In #134203, Daco enabled the Flutter Windows build to use native assets using the x64 MSVC toolchain. To enable targeting Arm64, we will need to update the logic added by #134203 to use the correct MSVC toolchain depending on the host/target.
(Daco feel free to correct any details I may have gotten wrong!)
Reacted by Daco HarkesHi, I'm currently working on windows-arm64 support and managed to get native (x64, arm64) and cross compilation (x64 -> arm64 and arm64 -> x64) of flutter apps to work on my local branch.
One issue I'm investigating now is support for native_assets, where it fails because
clcompiler can't be identified for arm64 architecture. After digging into this, I reached this native_toolchain_c/lib/src/native_toolchain/msvc.dart, and found that support need to be done here.I don't think flutter project will accept a windows-arm64 enablement without native assets, so it would be nice if we could fix this together @dcharkes. Once native repository has correct support, I should be able to do the rest on flutter side.
@loic-sharma: Do you see native assets as something mandatory for first enablement?
@dcharkes: Do you think anything more beyond toolchain detection has to be done to support new windows-arm64 platform?Thanks,
PierrickReacted by Parker Lougheed and Daco HarkesHi, I'm currently working on windows-arm64 support and managed to get native (x64, arm64) and cross compilation (x64 -> arm64 and arm64 -> x64) of flutter apps to work on my local branch.
🎉
One issue I'm investigating now is support for native_assets, where it fails because
clcompiler can't be identified for arm64 architecture. After digging into this, I reached this native_toolchain_c/lib/src/native_toolchain/msvc.dart, and found that support need to be done here.Yep, that sounds correct!
I don't think flutter project will accept a windows-arm64 enablement without native assets, so it would be nice if we could fix this together @dcharkes. Once native repository has correct support, I should be able to do the rest on flutter side.
Yes, please feel free to create PRs to the dart-lang/native repo to do toolchain detection. ❤️
I don't have access to an arm64 win machine myself. Neither do the GitHub actions have support for Windows arm64 as far as I know.
You should be able to have your local copy of the dart-lang/native packages and use a path dependency in the pubspec.yaml of flutter_tools to test your changes directly from flutter tools.@dcharkes: Do you think anything more beyond toolchain detection has to be done to support new windows-arm64 platform?
I'm not aware of anything. The
Abi.windowsArm64is already indart:ffi, and @rmacnak-google has been fixing corner cases recently. (There are some remaining corner cases: dart-lang/sdk#53829. If you run into a crash when doing an FFI call please give us a ping. But these are relatively uncommon cases: e.g. structs by value with specific struct sizes. This shouldn't stop you with implementing support for native assets for Windows arm64, as most tests just pass integer values.)Thanks for your reactive answer!
The advice about using a path in pubspec.yaml is what I was missing to try this locally, that should help.
I'll propose a PR to add support innativethen.Reacted by Daco Harkes- addedteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamand removed
on Jun 6, 2024 The
triaged-desktoplabel is irrelevant if there is noteam-desktoplabel orfyi-desktoplabel.- addedtriaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
on Jun 7, 2024 Was this supposed to be closed when #141930 landed? If not, what's the current status/next steps?
Reacted by kjxbyz- added a commit that references this issue
on May 11, 2026 - added a commit that references this issue
on Jun 10, 2026
Background
See: https://flutter.dev/go/windows-arm64
Once #129805 lands, Arm64 hosts will be able to build x64 executables. These executables run using x64 emulation.
Solution
HostPlatformandTargetPlatformenumsAbi.current()to determine the target architecture