You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How does cross-compilation work with native addons ?
#196
I'm using pkg to build an exe for win64.
When building from Windows itself it works perfectly but our CI is Linux and generates an exe that fails to start with ERR_DLOPEN_FAILED.
Our project uses serialport and we have an error when loading @serialport/bindings/build/Release/bindings.node .
The file exists but is not compatible with Windows (I think).
Different file sizes between what I find in .cache/pkg and what I have in my node_modules on Windows. (75ko in pkg cache vs 220ko)
So my question is how does pkg handles that ? because our npm ci in the Linux environment should install linux bindings and not Windows related stuff.
Thanks, but I think my problem was related to how serialport was loading the binding.
On v10+ they added an auto-detect feature which gets the correct binding for the current platform at runtime, we were using v9.
After updating (and some fixes to adapt to breaking changes) the exe starts normally without DLOPEN errors and works as intended.
Yes, that's what I did, but serialport runtime behaviour seems different between v9 and v10+, not related to pkg :)
I'm quite new to packaging nodejs apps and I first tried the built-in SEA feature, but it's clearly not working with native addons.
I had to keep some external node_modules aside from the exe and create a special require function for those modules, which is not what we want and is a pain to compress/decompress.
Pkg really helps here with its vfs and the "auto-extract" in its cache folder.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I'm using pkg to build an exe for win64.
When building from Windows itself it works perfectly but our CI is Linux and generates an exe that fails to start with ERR_DLOPEN_FAILED.
Our project uses serialport and we have an error when loading @serialport/bindings/build/Release/bindings.node .
The file exists but is not compatible with Windows (I think).
Different file sizes between what I find in .cache/pkg and what I have in my node_modules on Windows. (75ko in pkg cache vs 220ko)
So my question is how does pkg handles that ? because our
npm ciin the Linux environment should install linux bindings and not Windows related stuff.All reactions