flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.44k stars 27.31k forks source link

☂️ [macOS] Support building engine on Apple Silicon without Rosetta #103386

Open cbracken opened 2 years ago

cbracken commented 2 years ago

Currently, in order to build the engine on an Apple Silicon Mac, either as a host build or a target build, we need to build under Rosetta. This is for several reasons:

As such, we currently hardcode host_cpu to x64 for all macOS engine builds (including cross-compiles targeting arm64), and as such these builds are run under Rosetta.

Once this work is done:

Doing this is necessary to enable building unit tests in the host arm64 build on macOS. https://github.com/flutter/flutter/issues/115322 is the relevant sub-issue.

manuelduarte077 commented 2 years ago

oh this is great.

dnfield commented 2 years ago

I'm working on rolling swiftshader right now which should unblock arm64.

dnfield commented 2 years ago

Also requires https://github.com/flutter/flutter/issues/90425

cbracken commented 2 years ago

I've got a patch WIP that switches us over to the clang arm64 toolchain on Apple Silicon macs rather than using Rosetta. We still need to use the x64 toolchain to build gen_snapshot variant targeting x64 macs.

dkbast commented 1 year ago

Are there any updates, or issues we could help with? I'm really looking forward to giving "this" (building the engine without rosetta) another try, so if there is anything I can help with, please let me know :)

TheSin- commented 9 months ago

Did this fall off? Seems there has been no work or update on this in some time. Is there a arm64 or universal2 binary (using lipo) of the gen_snapshot_x binaries someplace we can manually install to help test with?

karatekid430 commented 8 months ago

+1 seriously there are no more Intel Macs being made

astronaute77 commented 8 months ago

Any progress on this?

sumitsahoo commented 4 months ago

Where are we on this?

cbracken commented 2 months ago

To post a quick update.

Our top priority is getting Flutter app developers using macOS hosts to the point where none of Flutter's tooling requires Rosetta. This work is tracked in https://github.com/flutter/flutter/issues/69157. Primarily this involves building universal binaries of gen_snapshot and other executables (flutter_tester, the libimobiledevice toolchain, etc.). Thus far, the macOS gen_snapshots have been migrated (in https://github.com/flutter/engine/pull/53524 and https://github.com/flutter/engine/pull/53962) and iOS's gen_snapshots have been migrated (in https://github.com/flutter/engine/pull/54009). Android's gen_snapshots and the libimobiledevice toolchain will be next. This is the top priority since there are far more developers building apps with Flutter than there are developers who actively commit to/build the engine/embedders.

Once all of that work is complete, we'll follow up with this issue, which eliminates the need for Rosetta for engine developers, unless opting in to building with the x64 toolchain, which we still want to keep around to address issues with Intel hosts while working on Apple Silicon Macs.