Repository navigation
[Windows Arm64] Allow cross compilation using --target-platform option #129808
Copy link
Copy link
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopplatform-target-armTargeting an ARM-based platformTargeting an ARM-based platformplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Description
Activity
- addedtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.platform-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-target-armTargeting an ARM-based platformTargeting an ARM-based platform
on Jun 30, 2023 - 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 Are there any news/timeline on this? A lot of Windows arm laptops were released this summer, mac devs can use windows arm with parallels but it's still impossible to build x64 flutter app from an arm windows environment
Reacted by JHubi1, kjxbyz, Piotr Rogowski, Losses Don, hmziq, Şems Turgut, Isaac Yeang, Maximilian Fornaçon, Skyler Thompson, PhD and MrPropreIf anybody wonders, you can actually build a x64 flutter app on ARM mac with Parallels by installing the ARM Windows 11.
When you open your project, go to windows/flutter/CMakeLists.txt file and change this
# Set fallback configurations for older versions of the flutter tool. if (NOT DEFINED FLUTTER_TARGET_PLATFORM) set(FLUTTER_TARGET_PLATFORM "windows-x64") endif()to this (basically comment the check to force x64 builds)
# Set fallback configurations for older versions of the flutter tool. # if (NOT DEFINED FLUTTER_TARGET_PLATFORM) set(FLUTTER_TARGET_PLATFORM "windows-x64") # endif()After this change apps build normally as you've built them on a default x64 machine and can be launched on any x64 pc without problems. Tested with latest m4 mac.
(But do not forget that flutter apps require you to copy msvcp140.dll, vcruntime140.dll and vcruntime140_1.dll files into your build folder, YOU MUST NOT copy them from the ARM' Windows/System32 folder since those are ARM64X dlls with hybrid PE headers and are not meant to be used on old x64 pcs so you have to copy them from your x64 windows machine!)
Reacted by Şems Turgut
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopplatform-target-armTargeting an ARM-based platformTargeting an ARM-based platformplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Background
See: https://flutter.dev/go/windows-arm64
Once #129807 lands,
flutter build windowswill always use the host architecture as the target architecture. In other words, Flutter on an Arm64 machine is unable to create AMD64 executables.Work
Add a
--target-platformoption toflutter build windowsto allow changing the target architecture.Using the
--target-platformoption should produce an error on the "beta" and "stable" release channels.