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

Unable to build arm64 native modules on Mac #55

Open
mmaietta opened this issue Apr 15, 2021 · 0 comments
Open

Unable to build arm64 native modules on Mac #55

mmaietta opened this issue Apr 15, 2021 · 0 comments

Comments

@mmaietta
Copy link
Collaborator

This is an issue that impacts electron-builder for arm64 Apple Silicon macs. Tested on v22.10.5

Using app-builder to generate .node files does not assemble them for the correct process architecture.
Example:

➜  shell git:(master) yarn postinstall                                      
yarn run v1.22.10
$ npm run install:native

> [email protected] install:native /Development/shell
> electron-builder node-gyp-rebuild; electron-builder install-app-deps

  • loaded configuration  file=/Development/shell/electron-builder.js
  • executing node-gyp rebuild  platform=darwin arch=arm64
  • electron-builder  version=22.10.5
  • loaded configuration  file=/Development/shell/electron-builder.js
  • rebuilding native dependencies  [email protected] platform=darwin arch=arm64
  • rebuilding native dependency  name=electron-deeplink version=1.0.6
✨  Done in 11.66s.

➜  shell git:(master) find . -name "*.node"  -print0 | xargs -0 -n 1 lipo -i
Non-fat file: ./node_modules/electron-deeplink/build/Release/electron-deeplink.node is architecture: x86_64
Non-fat file: ./build/Release/uta_native.node is architecture: x86_64
Non-fat file: ./build/Release/app.node is architecture: x86_64

All node modules are built as x64 despite being on an arm64 device. The console log says executing node-gyp rebuild platform=darwin arch=arm64 but the output is not arm64.

If one attempts to force the arch, it still fails to produce the correct asset:

➜  shell git:(master) yarn electron-builder install-app-deps  --arch arm64                              
yarn run v1.22.10
$ /Development/shell/node_modules/.bin/electron-builder install-app-deps --arch arm64
  • electron-builder  version=22.10.5
  • loaded configuration  file=/Development/shell/electron-builder.js
  • rebuilding native dependencies  [email protected] platform=darwin arch=arm64
  • rebuilding native dependency  name=electron-deeplink version=1.0.6
✨  Done in 3.69s.
➜  shell git:(master) find . -name "*.node"  -print0 | xargs -0 -n 1 lipo -i
Non-fat file: ./node_modules/electron-deeplink/build/Release/electron-deeplink.node is architecture: x86_64

In comparison, if using electron-rebuild, all modules are properly generated for arm64 by default

➜  shell git:(master) yarn electron-rebuild --arch arm64 -f
....verbose output
➜  shell git:(master) ✗ find . -name "*.node"  -print0 | xargs -0 -n 1 lipo -i
Non-fat file: ./bin/darwin-arm64-85/shell.node is architecture: arm64
Non-fat file: ./node_modules/electron-deeplink/bin/darwin-arm64-85/electron-deeplink.node is architecture: arm64
Non-fat file: ./node_modules/electron-deeplink/build/Release/electron-deeplink.node is architecture: arm64
Non-fat file: ./build/Release/uta_native.node is architecture: arm64
Non-fat file: ./build/Release/app.node is architecture: arm64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant