-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Fix linking of libsodium for linux #553
base: master
Are you sure you want to change the base?
Conversation
Build fails now: Actually, it is a correct bug/warning, as currently for linux builds, libsodium is not used, but defined as statically loaded:
So I will add libsodium to the linux build environment? We should consider adding libsodium-cmake as a build dependency from source maybe, to make it more easy/clear? |
@@ -76,6 +76,7 @@ | |||
['OS != "win"', { | |||
'libraries': [ | |||
'<(module_root_dir)/build/libzmq/lib/libzmq.a', | |||
"<!@(pkg-config libsodium --libs)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed here since it is handled inside CMake.
Do you get an error without this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know. But somehow it is needed for node-gyp in order to resolve symbols properly!
(In older build systems)
I verified this on the setup described above.
No compile error without this, but a runtime error:
bartel@ubuntu:~/Desktop/linux-unpacked$ node test.js
node: symbol lookup error: node_modules/zeromq/build/Release/zeromq.node: undefined symbol: sodium_init
bartel@ubuntu:~/Desktop/linux-unpacked$ cat test.js
const zeromq = require("./node_modules/zeromq/build/Release/zeromq.node")
console.log(zeromq)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I can confirm that this solved my issue with compiling native library for usage with electron (requires build against specific node version) on Linux (up-to-date Manjaro/Arch). Is there any chance to have this fix in official package? Cheers, Martin
Bumped into this issue myself when trying to build it on a Docket Debian 9 machine (circleci/node:gallium-stretch-browsers) with:
Compiling works fine, but when trying to run/require the
.node
module, I got the following error:I also found a bug report on stackoverflow by coincidence:
https://stackoverflow.com/questions/74796706/node-application-doesnt-start-with-zeromq-node-undefined-symbol-sodium-init
Apparently, as found in this post on stackoverflow: https://stackoverflow.com/questions/57740825/use-libsodium-in-napi, bindings.gyp also needs the libsodium
libraries
dependency in order to link properly.I did not change anything for Windows. As I suspect everything works okay there.
I guess it's also
OS
/gcc
/cmake
/node
related. As on my other VM build machine (Ubuntu 20.04 / gcc 9.4.0 / cmake 3.16.3 / node v18.12.1), I didn't have linker problems.I switched to an older build system as my findings of incompatible GLIBC versions, as described here: #529 (comment)
For setting up the docker build environment (maybe for future reference, as it was quite a pain: python 3.6 dependency, cmake 3.13+ dependency (https://stackoverflow.com/questions/68986713/git-bash-on-windows-cmake-error-the-source-directory-does-not-exists#comment121926826_68987727) / gcc 7+ (c++17) ):