Package apps with native module dependencies on platforms other than the host platform (cross-compilation)
See original GitHub issueI’m developing a desktop application based on Electron and I use electron-packager to create executable binary files on Mac OSX and Windows. My development box is on Mac OSX. In the my application, it uses some native node modules (like bcrypt). By saying native, I mean they are compiled to binary code when being installed by npm install
On my Mac, I package the app (using electron-packager) for Windows OS (packaging settings target to Windows 64 bits). And when I run the outcome package (.exe file along with other necessary files) on Windows 8.1 64 bits, an error appears at app launching
However, this problem won’t appear if the packaging takes place on a Windows OS (development tools like electron, electron-packager, node, etc. are available).
My question: Is there any practice or electron-based packaging tool (either electron-packager or else) that runs on one OS (either Mac OSX, Windows or Linux) and produce executable file targeted on different OS. For instance, I’d like to use that tool on my Mac and produce three executable packages on 03 different OS: Windows OS 32 bits, Windows OS 64 bits and Mac OSX.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:18
- Comments:11 (7 by maintainers)
@towertop electron-builder calls rebuild. But cross-compilation is not supported. And it is not electron-packager/electron-builder task — instead, authors of such modules should use https://www.npmjs.com/package/node-pre-gyp and simplify developers life. Maybe someday electron-builder will support it (precompile, upload to bintray, and use it in the all next builds).
@malept @buunguyen to build platform specific modules with node, you use node-gyp to standardise the build process and build on the target OS (so you have the correct compiler and libs). TMK there is no current way of compiling a node module with native extensions on an OS that is different to the target OS of the extension. The only support that
electron-packager
could reasonably give here is API support to grab pre-compiled platform specific binaries from a specified location and incorporate into the build - similar to whatelectron-prebuilt
does for electron itself. Grabbing binaries from the wild is rightly frowned upon - hence platform specific builds.