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

Apple Silicon Desktop Support #3553

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

aarongrider
Copy link

@aarongrider aarongrider commented Mar 19, 2022

Summary

This is an updated version of @colinbendell's PR here + build fixes and package.json changes: #3120

Apple Silicon Mac's do not run Flipper natively, instead using Rosetta to emulate.

The Electron builder only produces x86_64 builds and the PortForwardingApp is precompiled and committed in the code base with an x64 build.

This PR adds universal building of the electron app and the PortForwardingMacApp.

Addresses:

Changelog

  • Enable universal mac (x64/arm64) builds

Test Plan

  • yarn build --mac
  • Run flipper.app
  • Verify the app runs and that the kind is Apple in Activity Monitor

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 19, 2022
@umangloria
Copy link

umangloria commented Mar 23, 2022

Someone please check this PR and get it merged, Waiting for official universal builds for mac.
Also, Just tried a new build from PR and it seems working super speedy.

@andreialecu
Copy link

I believe this was blocked by this issue: #2606 (comment) as per @mweststrate

However, it seems that a fix just landed upstream in Electron:
electron/electron#33337

So hopefully this can be resolved soon. Flipper is very unpleasant to use on M1 macs right now.

@mweststrate
Copy link
Contributor

Yeah that is definitely good news! We'll wait for the stable release and proceed from there. Note that the whole issue can be avoided btw if you run the Flipper browser version: npx flipper-browser. We're still working on that one, so hasn't been officially announced, but should be quite feature complete at this point :)

@umangloria
Copy link

Can someone please revise this PR?

@obsantos
Copy link

@passy Do we have an ETA on this? My mac reports Flipper as high battery consumer and its probably related to simulation/rosetta. This change would be much appreciated!

@cristiandan
Copy link

Any luck with this guys? Would help a lot M1 based macs

@aarongrider aarongrider force-pushed the m1-universal branch 2 times, most recently from 4af1296 to 0076c83 Compare May 12, 2022 15:17
@aarongrider
Copy link
Author

Another ping on this. Please let me know if there are any changes needed.

@kelset
Copy link

kelset commented May 16, 2022

I think pinging @lblasa might be the right way :)

@mweststrate
Copy link
Contributor

We'll have hackathon in a couple of weeks at we will take a new attempt :) For the adventurous; we have experimental npx flipper-server that you can use to run Flipper from the browser, and doesn't suffer from the Electron limitations as it runs on node.js.

@coveralls
Copy link

coveralls commented May 16, 2022

Pull Request Test Coverage Report for Build 3014555494

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 49.948%

Totals Coverage Status
Change from base Build 3014440859: -0.03%
Covered Lines: 7826
Relevant Lines: 14219

💛 - Coveralls

@lblasa
Copy link
Contributor

lblasa commented May 16, 2022

Apple Silicon support has been on my list for a while now. As @mweststrate mentioned, we have a hackathon in a couple of weeks in which we can definitely try and make this happen :)

@andreialecu
Copy link

We'll have hackathon in a couple of weeks at we will take a new attempt :) For the adventurous; we have experimental npx flipper-server that you can use to run Flipper from the browser, and doesn't suffer from the Electron limitations as it runs on node.js.

Hey @mweststrate I tried flipper-server but ran into:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/idb_companion'

The right location is:

➜ which idb_companion
/opt/homebrew/bin/idb_companion

I have idb_companion installed via homebrew. I ran ln -s /opt/homebrew/bin/idb_companion /usr/local/bin/idb_companion as a workaround and got past the error. Is there a separate repository for flipper-server where I can report this?

The page it opens isn't working though. Gets stuck on "Loading..." and there's this in the browser's console.

Screenshot 2022-06-02 at 14 30 53

Relevant code (seems to try to access process in the browser):
Screenshot 2022-06-02 at 14 31 17

@limal
Copy link

limal commented Jun 30, 2022

@aarongrider you're the man! Thank you so much. I was astonished to learn that there can be no official M1 builds in 2022.

I made a quick tutorial on how to run your fork for folks like me, i.e. using Apple machines as dev tools out of necessity and not that experienced with the Mac ecosystem.

https://dev.to/limal/speed-boost-to-flipper-debugger-on-apple-m1-1gh

@scarlac
Copy link

scarlac commented Jul 1, 2022

@lblasa What do we need to test/do to get this further along? Flipper performs quite poorly overall so M1 support would make a significant difference to the debugging experience and thus the overall RN experience.

@umangloria
Copy link

Hey @aarongrider I was using v145 (universal build from your repo). However after updating the code to latest one I am unable to create new build:
Getting this error:

Script termnated. Error: Expected all non-binary files to have identical SHAs when creating a universal build but "Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects-101300.nib" did not
    at exports.makeUniversalApp (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/@electron/universal/src/index.ts:118:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at MacPackager.doPack (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/app-builder-lib/src/macPackager.ts:125:9)
    at MacPackager.pack (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/app-builder-lib/src/macPackager.ts:179:7)
    at Packager.doBuild (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/app-builder-lib/src/packager.ts:441:9)
    at Object.executeFinally (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/app-builder-lib/src/packager.ts:376:31)
    at Packager.build (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/app-builder-lib/src/packager.ts:337:12)
    at Object.executeFinally (/Users/umangloriya/Documents/flipper m1/desktop/node_modules/builder-util/src/promise.ts:12:14)
    at buildDist (/Users/umangloriya/Documents/flipper m1/desktop/scripts/build-release.tsx:270:5)
    at /Users/umangloriya/Documents/flipper m1/desktop/scripts/build-release.tsx:323:3
error Command failed with exit code 1.

Any suggestion or help will be appreciated !! thank you for this work

@Arkkeeper
Copy link

@umangloria you can add "@electron/universal": "1.3.0", to the resolutions section in flipper/desktop/package.json (and then yarn again, of course)

* added PortForwardingMacApp project target
* updated Podfiles
* updated electron builder to 22.14.10
* updated electron to 16.0.3
* added universal architecture to the build process
@facebook-github-bot
Copy link
Contributor

@lblasa has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@lblasa
Copy link
Contributor

lblasa commented Sep 8, 2022

I apologise for the delay on this one. I've just taken the changes locally and will review shortly.

@umangloria
Copy link

@lblasa Any update on this please?

@lblasa
Copy link
Contributor

lblasa commented Sep 21, 2022

@lblasa Any update on this please?

This is currently in the pipeline. We are considering switching from PortForwardingMacApp to just use idb.

idb already has port forwarding and is a hard dependency for debugging apps on a device so it just makes sense to simplify our approach.

I will share an update as soon as there is one :)

@alexyangjie
Copy link

Could someone please push this forward? Debugging with Flipper is a pain in Apple Silicon macs. It is probably the slowest app on my mac right now, and is the only app that hasn't had any Apple Silicon native builds.

@chiragramani
Copy link

chiragramani commented Dec 10, 2022

Hey @lblasa , can you help with the above please?
We see no frame drops with a universal binary and the performance is a lot better(than a Rosetta translated Flipper).

@chiragramani
Copy link

Created a GitHub workflow that cherry-picks the author's (@aarongrider) PR on every flipper releases with a minor patch(electron universal - 1.3.4). Repo: https://github.com/chiragramani/FlipperReleases and the releases section has the universal binary.

Hope this is helpful until Meta distributes a universal Flipper binary.

@umangloria
Copy link

umangloria commented Dec 11, 2022

Created a GitHub workflow that cherry-picks the author's (@aarongrider) PR on every flipper releases with a minor patch(electron universal - 1.3.4). Repo: https://github.com/chiragramani/FlipperReleases and the releases section has the universal binary.

Hope this is helpful until Meta distributes a universal Flipper binary.

Amazing work, It seems the repo is private, Could you please change it to public ?

@chiragramani
Copy link

Created a GitHub workflow that cherry-picks the author's (@aarongrider) PR on every flipper releases with a minor patch(electron universal - 1.3.4). Repo: https://github.com/chiragramani/FlipperReleases and the releases section has the universal binary.
Hope this is helpful until Meta distributes a universal Flipper binary.

Amazing work, It seems the repo is private, Could you please change it to public ?

Oh, thanks, made it public!

@markholland
Copy link

Any updates on this? I've been using the excellent repo provided by @chiragramani but builds have started failing for the second time in the last month or so and would love to see an official release.

@tconroy
Copy link

tconroy commented Nov 14, 2023

Hi @lblasa! Just wanted to +1 @markholland above, would love to better understand the state of official M1 support since the alt repos for arm64 binaries aren't working quite right.

You mentioned it was in the pipeline back in September 2022, so it's been over a year now. Any updates would be much appreciated! And thanks to you and all the other contributors for your hard work on Flipper! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.