-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Multiplatform native dependencies pre-build and how to require #5750
Comments
This sounds like a great candidate for node-pre-gyp. Just to confirm, you're trying to lipo together a universal "fat" binary for MacOS and receiving an error message that the |
@mmaietta thank you for your reply.
Being able to create a universal binary would be nice for the future but for the time being not required. When we build both archs on a silicon mac the native one works as expected and the x64 opens but without displaying anything or any error in the console. The opposite happens when we build on an intel based mac but there we get errors about Is this because of the node version being used per machine?
Indeed this is the best option because we want to be able to build "build": {
"remoteBuild": false,
"artifactName": "app-v${version}-${arch}.${ext}",
"directories": {
"output": "build"
},
"win": {
"target": [
{
"target": "nsis",
"arch": "x64"
}
]
},
"squirrelWindows": {
"msi": true
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": false,
"createDesktopShortcut": "always",
"license": "license.html"
},
"mac": {
"hardenedRuntime": true,
"entitlements": "electron/entitlements.mac.inherit.plist",
"entitlementsInherit": "electron/entitlements.mac.inherit.plist",
"target": [
{
"target": "default",
"arch": [
"x64",
"arm64"
]
}
]
} The procedure could be something like:
Also, how can we force those links as to find the binaries?: electron-builder --macos --x64
• electron-builder version=22.10.5 os=20.3.0
• loaded configuration file=package.json ("build" field)
• writing effective config file=build/builder-effective-config.yaml
• rebuilding native dependencies [email protected], [email protected], [email protected] platform=darwin arch=x64
• install prebuilt binary name=robotjs version=0.6.3 platform=darwin arch=x64
• build native dependency from sources name=robotjs
version=0.6.3
platform=darwin
arch=x64
reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
error=prebuild-install info begin Prebuild-install version 5.3.6
prebuild-install info looking for cached prebuild @ /Users/admin/.npm/_prebuilds/dc29d9-robotjs-v0.6.3-electron-v87-darwin-x64.tar.gz
prebuild-install http request GET https://github.com/intermedia-net/robotjs/releases/download/v0.6.3/robotjs-v0.6.3-electron-v87-darwin-x64.tar.gz
prebuild-install http 404 https://github.com/intermedia-net/robotjs/releases/download/v0.6.3/robotjs-v0.6.3-electron-v87-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.0.2 runtime=electron arch=x64 libc= platform=darwin) Any suggestions are greatly appreciated :) |
@mmaietta it turns out that the no-screen issue is due to bytenode. When removed, both mac versions worked correctly when compiled on M1. It would be lovely though if you could shed some light on how to also build or import the native dependencies for the windows build. |
Curious, I think someone either asked for this feature or confirmed that it worked, but can you try using an
Alternatively, my project's approach is to rebuild the node modules on every build, as it's a simple setup and minimally impacts build time. My config looks like this:
|
Thank you for your help, @mmaietta. Figuring these out and learning new stuff every day. Closing this now as it has to do with when bytenode runs and under which architecture when packaging a universal build. |
We are on Apple M1 Macs building for both arm64 and x64 with node v15.12.0 as also for windows nsis x64.
This works great when not using native modules.
Though, in our case we have:
and as so the app only works if compiled in their respective environment.
That creates many problems like:
So the main question is:
How to pre-build these native modules (each on a specific computer) and then require them on build time with electron builder?
ps: We are aware that bytenode may misbehave but that is another issue that may be solved by just downgrading node to v14 and using rosetta to compile.
The text was updated successfully, but these errors were encountered: