node-sodium icon indicating copy to clipboard operation
node-sodium copied to clipboard

Fails to compile on openSUSE LEAP 15 (../deps/build/lib/libsodium.a: No such file or directory )

Open udf2457 opened this issue 6 years ago • 8 comments
trafficstars

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.

udf2457 avatar Dec 09 '18 18:12 udf2457

I'm getting the same error with a discord.js bot, ending pretty much at the same spot as yours.

rawr51919 avatar Feb 15 '19 03:02 rawr51919

OK, @udf2457, try globally installing libsodium-wrappers using npm -i -g libsodium-wrappers, then retry sodium compilation. It should help with your issue.

rawr51919 avatar Feb 15 '19 18:02 rawr51919

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.

lbeltrame avatar Jan 12 '20 22:01 lbeltrame

Should be a minor fix, then. Just have it look in lib64 instead of lib @lbeltrame

rawr51919 avatar Jan 12 '20 22:01 rawr51919

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.

lbeltrame avatar Jan 12 '20 22:01 lbeltrame

Would be PR-worthy, then.

rawr51919 avatar Jan 12 '20 22:01 rawr51919

Probably, although I patched 2.0.3 because that's what a discord lib I used wanted.

lbeltrame avatar Jan 12 '20 22:01 lbeltrame

The opposite could also work (using lib instead of lib64). Whichever is easier

rawr51919 avatar Jan 12 '20 22:01 rawr51919