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
arm64 build crashes if user has used x64 build previously #27206
Comments
Have you tried cleaning up ~/Library/Application\ Support/YourAPP ? Maybe electron saves some binary file there that broke the launch with a different arch. |
Yeah, I did try removing that directory and a few others – no change. |
According to https://apple.stackexchange.com/a/414517, "Cache files of Rosetta 2 are located at both Can you try wiping those out and see if it makes a difference? My guess is that Rosetta 2 is caching the fact that an application needs to be translated using its app name as an identifier, and that might be stored somewhere in that cache.
I guess its mainly |
This website (https://ffri.github.io/ProjectChampollion/part1/) provides some interesting background on Rosetta 2. This part is particularly interesting:
I think it might be that The file names look like this, apparently:
Can you find a directory here that contains files for your application? What happens if you delete them?
That is confusing though. Could it be that Rosetta 2 also caches the fact that a binary does not need to be translated, and therefore also blindly skips the translation here? |
@KishanBagaria Does it make a difference if the arm64 application sets the I believe this will make the operating system ignore the Rosetta 2 cache and execute the app natively as normal without any errors. Let me know how it goes! |
Cannot access Same issue after setting
(Verified with |
The issue might be related to ffi-napi – the app ran when it wasn't imported but crashed as soon as |
@KishanBagaria Could it be that the native library you are loading with |
We aren't loading the library. The code literally is just |
@KishanBagaria That module is a native C++ add-on. They also publish pre-built binaries (see https://github.com/node-ffi-napi/node-ffi-napi/releases/tag/v4.0.3), but not for arm64. What happens if you force re-compilation of the native add-on by setting |
We've already rebuilt that add-on and others for Electron 11 using electron-rebuild. It'd not work on arm64 machines without doing that and throw a different error. The arm64 build is fully functional as long as the user hasn't swapped the x64 build with it. Edit: the |
So just to summarize our findings so far:
The hypothesis is that the issue is somehow tied to the file system path the application is copied to, as i.e. renaming the app makes it all work again.
Looks like that error is coming from Is there a chance you can run this on a debug Electron build, so that we can better see where the error is coming from? |
This is correct.
It's unknown if
Yep.
Sure, how do we do that? Do you have a link to download the debug build? We're using Electron v11.4.6. |
Just to add in this issue that we also have been fighting with.
The very same app when built from an x64 intel mac works perfectly and the same works when building an arm64 from an m1. |
This is still happening with electron 18.0.1 and electron-builder 24.0.5 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue. |
I have the same issue |
Issue Details
Actual Behavior
We shipped an Electron app only for x64 architecture initially. It has some native dependencies. Some users used it on their M1 / Apple silicon Macs with Rosetta 2.
Recently, we built the app for arm64 arch with electron-builder and shipped an update to those users. We determined if the process was translated with
sysctl sysctl.proc_translated
/app.runningUnderRosettaTranslation
. It wasn't a universal binary, just arm64.Now those users are unable to open the app – it crashes on launch.
If they rename the app or move it, it works.
To Reproduce
A user uses Foo.app (x64 only) with Rosetta 2.
Some time later, Foo.app (x64) auto-updates to Foo.app (arm64, not universal binary). App path stays the same: /Applications/Foo.app
Instead of auto update, user can also delete the x64 version and replace it with the arm64 version.
After the update, Foo.app (arm64) crashes on launch.
If the user renames Foo.app to anything else (Foo2.app) or moves it to a different location, it starts working.
Screenshots
Additional Information
If the user launches the app through Terminal by running
/Applications/Foo.app/Contents/MacOS/Foo
, it runs and works fine.This issue also happens if the user was using the arm64-only version initially and replaced it with the x64-only version. The x64 version will crash on launch in that instance.
We got reports from three different users about this (one using M1 Mac Mini, another using M1 MacBook Pro). We were able to reproduce and confirm this on a clean Mac Mini.
The text was updated successfully, but these errors were encountered: