question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package apps with native module dependencies on platforms other than the host platform (cross-compilation)

See original GitHub issue

I’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

bcrypt-failed-win64

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:closed
  • Created 8 years ago
  • Reactions:18
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
develarcommented, Jun 15, 2016

@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).

1reaction
rishsoncommented, Jan 31, 2016

@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 what electron-prebuilt does for electron itself. Grabbing binaries from the wild is rightly frowned upon - hence platform specific builds.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package apps with native module dependencies on platforms ...
Package apps with native module dependencies on platforms other than the host platform (cross-compilation) #215.
Read more >
Faster Multi-Platform Builds: Dockerfile Cross-Compilation ...
When Go applications depend on other Go modules they usually do it by either including the sources of the dependencies inside a vendor...
Read more >
Linux IL2CPP Cross Compiler Packages Now Available in ...
On macOS and Windows, Linux-IL2CPP module installed; Correct toolchain for host platform installed; ScriptingBackend set to IL2CPP. Known issues
Read more >
Binaries and Dependencies - The Sheer Joy of Packaging!
Understand why we build Python packages with native binaries: 1) performance and 2) library integration; Understand different components of the binary build ...
Read more >
Building Go Applications for Different Operating Systems and ...
Go supports cross-platform compiling by building support for multiple platforms directly into the go build tool. By using the GOOS and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found