Skip to content

☂️ Add support for ARM macOS host #60118

Closed

Description

@jmagman

Umbrella issue tracking developing Flutter on macOS ARM.
Use case: developer buys ARM Mac, installs Flutter tooling on the Mac, deploys Flutter to an iPhone.

  • Build tool on macOS ARM
  • Build ARM host dependencies (iproxy, libimobiledevice). Rosetta translation?
  • IDE support
  • Infrastructure support

Note: this is tracking host-side issues. Running Flutter on ARM macOS as a target is tracked by #60113.

Wiki page: https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon

Update: Flutter should be fully working on M1 with Rosetta translation (particularly tooling and iOS simulator). The remaining work is to get it working natively without Rosetta.

Infrastructure

Native host development (flutter tool)

Completed

Sub-issues

Physical devices

Simulator

Plugin support

Tracking Apple Silicon as a target device separately at #60113.

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    platform-macosBuilding on or for macOS specifically
    P1High-priority issues at the top of the work list
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    on Jun 23, 2020
  2. cbenhagen commented on Jun 30, 2020

    @cbenhagen
    Contributor

    Building flutter tool on ARM macOS host currently fails with:

    Building flutter tool...
    oah error: unhandled 16KB-unaligned mmap addr=0x0 len=0xdd28c0 offset=0x1000 prot=1 flags=2
    /Users/ben/development/flutter/bin/internal/shared.sh: line 20:  1298 Trace/BPT trap: 5       "$PUB" upgrade "$VERBOSITY" --no-precompile
    Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
    

    Leaving this here so it can be found by a google search. But maybe it should be moved to a separate issue?

  3. jmagman commented on Jun 30, 2020

    @jmagman
    MemberAuthor

    Leaving this here so it can be found by a google search. But maybe it should be moved to a separate issue?

    Yes, can you file a separate issue? I heard about this but we don't have DTKs yet. I'll link it back to this umbrella meta issue.

  4. jmagman commented on Jun 30, 2020

    @jmagman
    MemberAuthor
  5. cbenhagen commented on Jun 30, 2020

    @cbenhagen
    Contributor
  6. christopherfujino commented on Jul 8, 2020

    @christopherfujino
    Contributor

    Just to cross reference, tracking linux arm host support on #56992

  7. alexmarkley commented on Sep 19, 2020

    @alexmarkley

    I'm happy to report that my experience with Flutter master branch on Apple Silicon / DTK has been much better than others early experiences ( ala dart-lang/sdk#42534 ). At this point Rosetta seems to be able to run most of the host tooling, and I am able to target iOS using the generated Xcode project.

    Per #65132 the flutter run tool is still not working. Also, per #64502 the simulator does not work correctly on ARM hosts.

    However, and I think this is super cool, actually building and running the Flutter application on-device using Xcode 12.2 Beta is working as expected. I can even use flutter attach to observe and interact with the running application!

    If I am able to get my local development environment to work correctly ( dart-lang/sdk#43488 ) I'm optimistic that I can participate in the porting effort to get the tooling running natively on the ARM host.

  8. jmagman commented on Oct 1, 2020

    @jmagman
    MemberAuthor

    flutter run -d macos worked out of the box (as a rosetta app):
    Screen Shot 2020-09-30 at 6 49 44 PM
    Screen Shot 2020-09-30 at 6 50 08 PM

  9. xster commented on Oct 1, 2020

    @xster
    Member

    @jmagman I think we were talking about "XCode SDK needs to be updated on mac LUCI builders" just now. Should that be better named as "mac LUCI builders' Xcode need to use the iOS 14 SDK"?

  10. 22 remaining items

  11. xster commented on Dec 14, 2020

    @xster
    Member

    Should we leave #64502 and create a separate bug for running iOS simulator on rosetta?

  12. jmagman commented on Dec 14, 2020

    @jmagman
    MemberAuthor

    Should we leave #64502 and create a separate bug for running iOS simulator on rosetta?

    #72294

  13. xster commented on Jan 25, 2021

    @xster
    Member

    Created #74662 to wrap up documentation for the next stable

  14. jmagman commented on Mar 5, 2021

    @jmagman
    MemberAuthor

    On Flutter 2 deploying your app in Rosetta mode to the iOS simulator with the command line tool flutter run/ flutter build ios --simulator, or from a Flutter IDE plugin should work. Targeting the iOS simulator from Xcode is supported without manual project changes as of #73828, which is currently available on the master channel.

  15. jmagman commented on Jul 1, 2021

    @jmagman
    MemberAuthor

    Native arm64 iOS simulator without Rosetta now available as of #85642.

  16. self-assigned this
    on Apr 20, 2022
  17. cbracken commented on May 12, 2022

    @cbracken
    Member

    Engine building on arm64 mac hosts as of flutter-team-archive/engine#33244

  18. jmagman commented on May 13, 2022

    @jmagman
    MemberAuthor

    There are also arm64 Mac tests running like

    flutter/.ci.yaml

    Line 3122 in 708c363

    - name: Mac_arm64_ios flutter_gallery_ios__compile

    This is complete. We can track the ew remaining x64 binaries separately at #69157.

  19. cbracken commented on May 13, 2022

    @cbracken
    Member

    SGTM. We're now generating arm64/arm64 (as well as x64/simarm64) binaries for gen_snapshot in macOS engine host builds. I'm happy to take a look at getting a lipo'ed universal binary for gen_snapshot in place.

  20. jmagman commented on May 14, 2022

    @jmagman
    MemberAuthor

    SGTM. We're now generating arm64/arm64 (as well as x64/simarm64) binaries for gen_snapshot in macOS engine host builds. I'm happy to take a look at getting a lipo'ed universal binary for gen_snapshot in place.

    @zanderso says it's more complicated than lipoing, more info in #101138.

  21. cbracken commented on May 14, 2022

    @cbracken
    Member

    If I understand the issue pointed to there, a bunch of that was fixed in flutter-team-archive/engine#33244. That's what I meant by us now generating native arm64/arm64 binaries rather than x86/simarm64. But maybe I'm misreading this?

    The issue we still do definitely have though is no arm64 binaries that target x64 architecture, which is due to the lack of simx64 support in Dart, but my understanding was that #101138 is about an arm64->arm64 gen_snapshot, not the arm64->x64 case.

  22. jmagman commented on May 16, 2022

    @jmagman
    MemberAuthor

    If I understand the issue pointed to there, a bunch of that was fixed in flutter-team-archive/engine#33244.

    Neat, I didn't see that PR. Feel free to close what you think is complete.

    but my understanding was that #101138 is about an arm64->arm64 gen_snapshot, not the arm64->x64 case.

    That's what I meant to track with that issue since that's within our ability do to now given dart limitations.

    @zanderso I thought we couldn't just lipo gen_snapshots together because of... some reason you've explained to me at least 4 times.

  23. zanderso commented on May 16, 2022

    @zanderso
    Member

    We could lipo together the gen_snapshot binaries that target arm64, but not the gen_snapshot binaries that target x64. The reason is that Dart only supports generating intel code when running on an intel host.

    My suggestion for now is to keep things simple and ship non-lipo'd gen_snpashots targeting both arm64 and x64 as intel binaries, which will run under Rosetta on M1.

  24. cbracken commented on May 17, 2022

    @cbracken
    Member

    sgtm!

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

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.platform-host-armBuilding on an ARM-based platformplatform-macosBuilding on or for macOS specificallytoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions