Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☂️ Add support for ARM macOS host #60118

Closed
34 of 35 tasks
jmagman opened this issue Jun 23, 2020 · 34 comments
Closed
34 of 35 tasks

☂️ Add support for ARM macOS host #60118

jmagman opened this issue Jun 23, 2020 · 34 comments
Assignees
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. P2 Important issues not at the top of the work list platform-host-arm Building on an ARM-based platform platform-mac Building on or for macOS specifically tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@jmagman
Copy link
Member

jmagman commented Jun 23, 2020

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.

@jmagman jmagman added tool Affects the "flutter" command-line tool. See also t: labels. platform-mac Building on or for macOS specifically P2 labels Jun 23, 2020
@jmagman jmagman added P1 High-priority issues at the top of the work list and removed P2 labels Jun 23, 2020
@jmagman jmagman added P2 Important issues not at the top of the work list and removed P1 High-priority issues at the top of the work list labels Jun 23, 2020
@cbenhagen
Copy link
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?

@jmagman
Copy link
Member Author

jmagman commented Jun 30, 2020

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.

@jmagman
Copy link
Member Author

jmagman commented Jun 30, 2020

@cbenhagen Can you file in https://github.com/dart-lang/sdk ?

@cbenhagen
Copy link
Contributor

Done: dart-lang/sdk#42534

@christopherfujino
Copy link
Member

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

@alexmarkley
Copy link

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.

@jmagman
Copy link
Member Author

jmagman commented Oct 1, 2020

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

@jmagman jmagman mentioned this issue Oct 1, 2020
8 tasks
@xster
Copy link
Member

xster commented Oct 1, 2020

@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"?

@jmagman
Copy link
Member Author

jmagman commented Oct 1, 2020

@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"?

Done at #65901 (comment).

@jonahwilliams
Copy link
Member

Ship it!

@jmagman
Copy link
Member Author

jmagman commented Nov 12, 2020

Trying to understand the current state of this issue.. Is it accurate to say that if I were to buy an ARM Mac next week, I would probably require a physical iOS device to do Flutter development as Flutter would not be able to build on ARM simulators running on the new Macs. But I should still be able to build a release version of the app for iOS without problems.

That's a good summary. I would add that mac desktop apps are working in Rosetta.

Also, last time I tried, CocoaPods wasn't working on arm, so apps with plugins won't work.

@joniaiuser
Copy link

Trying to understand the current state of this issue.. Is it accurate to say that if I were to buy an ARM Mac next week, I would probably require a physical iOS device to do Flutter development as Flutter would not be able to build on ARM simulators running on the new Macs. But I should still be able to build a release version of the app for iOS without problems.

That's a good summary. I would add that mac desktop apps are working in Rosetta.

Also, last time I tried, CocoaPods wasn't working on arm, so apps with plugins won't work.

I saw in one of the linked issues someone posted a workaround, is that not a viable solution?

CocoaPods/CocoaPods#9907 (comment)

christopherfujino added a commit that referenced this issue Nov 13, 2020
* App.framework must support iOS 8 for older Flutter projects
* cherry pick fixes to #60118
* fix to --observatory-port flag
* update engine version

Co-authored-by: Jenn Magder <magder@google.com>
@jmagman
Copy link
Member Author

jmagman commented Nov 18, 2020

I saw in one of the linked issues someone posted a workaround, is that not a viable solution?

CocoaPods/CocoaPods#9907 (comment)

It didn't work for me, CocoaPods would crash with LoadError - dlsym(0x7fbbeb6837d0, Init_ffi_c): symbol not found. Workaround is to install x86_64 ffi gem:

arch -x86_64 sudo gem install ffi

Flutter work tracked at #70796

@pedromassangocode pedromassangocode added the customer: crowd Affects or could affect many people, though not necessarily a specific customer. label Nov 19, 2020
@jtoy

This comment has been minimized.

@EArminjon

This comment has been minimized.

@sunface

This comment has been minimized.

@benjaminschreck

This comment has been minimized.

@jmagman
Copy link
Member Author

jmagman commented Nov 23, 2020

This wiki page is a more digestible form of what works and what doesn't. This issue is a convenience meta issue, so I'm going to lock for now to prevent noise.

@flutter flutter locked as off-topic and limited conversation to collaborators Nov 23, 2020
@TahaTesser TahaTesser added the platform-host-arm Building on an ARM-based platform label Dec 3, 2020
@xster
Copy link
Member

xster commented Dec 14, 2020

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

@jmagman
Copy link
Member Author

jmagman commented Dec 14, 2020

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

#72294

@xster
Copy link
Member

xster commented Jan 25, 2021

Created #74662 to wrap up documentation for the next stable

@jmagman
Copy link
Member Author

jmagman commented Mar 5, 2021

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.

@jmagman
Copy link
Member Author

jmagman commented Jul 1, 2021

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

@cbracken cbracken self-assigned this Apr 20, 2022
@cbracken
Copy link
Member

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

@jmagman
Copy link
Member Author

jmagman commented May 13, 2022

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.

@jmagman jmagman closed this as completed May 13, 2022
@cbracken
Copy link
Member

cbracken commented May 13, 2022

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.

@jmagman
Copy link
Member Author

jmagman commented May 14, 2022

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.

@cbracken
Copy link
Member

cbracken commented May 14, 2022

If I understand the issue pointed to there, a bunch of that was fixed in flutter/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.

@jmagman
Copy link
Member Author

jmagman commented May 16, 2022

If I understand the issue pointed to there, a bunch of that was fixed in flutter/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.

@zanderso
Copy link
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.

@cbracken
Copy link
Member

sgtm!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. P2 Important issues not at the top of the work list platform-host-arm Building on an ARM-based platform platform-mac Building on or for macOS specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

16 participants