node-sodium
node-sodium copied to clipboard
Fails to compile on openSUSE LEAP 15 (../deps/build/lib/libsodium.a: No such file or directory )
openSUSE LEAP 15 node v10.14.1
libsodium 1.0.16 (https://github.com/jedisct1/libsodium/releases) compiles fine, no problems.
However, add "sodium": "^3" to package.json and run npm update (npm cache clean -f has no effect):
../src/crypto_pwhash_algos.cc:25:1: note: in expansion of macro ‘CRYPTO_PWHASH_DEF’ [21/1903]
CRYPTO_PWHASH_DEF(scryptsalsa208sha256)
^~~~~~~~~~~~~~~~~
CXX(target) Release/obj.target/sodium/src/crypto_pwhash.o
CXX(target) Release/obj.target/sodium/src/crypto_hash.o
CXX(target) Release/obj.target/sodium/src/crypto_hash_sha256.o
CXX(target) Release/obj.target/sodium/src/crypto_hash_sha512.o
CXX(target) Release/obj.target/sodium/src/crypto_shorthash.o
CXX(target) Release/obj.target/sodium/src/crypto_shorthash_siphash24.o
CXX(target) Release/obj.target/sodium/src/crypto_generichash.o
CXX(target) Release/obj.target/sodium/src/crypto_generichash_blake2b.o
CXX(target) Release/obj.target/sodium/src/crypto_onetimeauth.o
CXX(target) Release/obj.target/sodium/src/crypto_onetimeauth_poly1305.o
SOLINK_MODULE(target) Release/obj.target/sodium.node
g++: error: ../deps/build/lib/libsodium.a: No such file or directory
make[1]: *** [sodium.target.mk:141: Release/obj.target/sodium.node] Error 1
make[1]: Leaving directory '/usr/share/foobar/node/test1/node_modules/sodium/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib64/node_modules/npm10/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.12.14-lp150.12.25-default
gyp ERR! command "/usr/bin/node10" "/usr/lib64/node_modules/npm10/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/share/foobar/node/test1/node_modules/sodium
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
make: *** [Makefile:82: nodesodium] Error 1
/usr/share/foobar/node/test1/node_modules/sodium/install.js:293
throw new Error(cmdLine + ' exited with code ' + code);
^
Error: make nodesodium exited with code 2
at ChildProcess.<anonymous> (/usr/share/foobar/node/test1/node_modules/sodium/install.js:293:19)
at ChildProcess.emit (events.js:182:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js --install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
I'm getting the same error with a discord.js bot, ending pretty much at the same spot as yours.
OK, @udf2457, try globally installing libsodium-wrappers using npm -i -g libsodium-wrappers, then retry sodium compilation. It should help with your issue.
Posting after a year due to the same issue: It doesn't work, because it looks in "lib" while the static libsodium is installed in "lib64" in the build directory.
Should be a minor fix, then. Just have it look in lib64 instead of lib @lbeltrame
That's what I'm trying to do at this point. Will report back.
Note that lib is hardcoded in the sources, so it requires manual modifications.
Would be PR-worthy, then.
Probably, although I patched 2.0.3 because that's what a discord lib I used wanted.
The opposite could also work (using lib instead of lib64). Whichever is easier