Ich installiere scrypt
(https://www.npmjs.com/package/scrypt) von npm. Die Installation umfasst einen Buildschritt node-gyp
, der eine systemeigene Erweiterung node.js erstellt. Als ich dann meine app starten, kann es mit dem folgenden Fehler:Wie erkläre ich einer nativen node.js Erweiterung, wo (die richtige) libstdC++ zu finden?
node index.js
module.js:568
return process.dlopen(module, path._makeLong(filename));
^
Error: /package/host/localhost/gcc-4/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/xxxx/xxxx/node_modules/scrypt/build/Release/scrypt.node)
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/xxxx/xxxx/node_modules/scrypt/index.js:3:20)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/xxxx/xxxx/node_modules/unfun-cms/lib/utils/password.js:3:16)
, die nicht so überraschend, weil
[[email protected] nodeapp]$ strings /package/host/localhost/gcc-4/lib64/libstdc++.so.6 | grep "GLIBCXX_3\.4\.21"
[[email protected] nodeapp]$
während
[[email protected] nodeapp]$ strings /package/host/localhost/gcc-5/lib64/libstdc++.so.6 | grep "GLIBCXX_3\.4\.21"
GLIBCXX_3.4.21
[[email protected] nodeapp]$
I
export PATH=/package/host/localhost/gcc-5/bin:$PATH
export LD_LIBRARY_PATH=/package/host/localhost/gcc-5/lib64:$LD_LIBRARY_PATH
haben
in meinem .bashrc
und gcc --version
zeigt 5.2.0
richtig an, also nehme ich an, dass diese Einstellungen in Ordnung sind.
Also die Frage ist, wie kann ich sagen, scrypt
den Weg zum richtigen libstdc++.so.6
, nämlich die bei /package/host/localhost/gcc-5/lib64/libstdc++.so.6
? (Und warum tut es auch etwas falsch gemacht?)
EDIT:
Dies ist eine CentOS Maschine. Ich verwende node.js Version 6.1.0
, npm Version 3.8.6
, und ich versuche, scrypt
Version 6.0.3
zu installieren, die die neueste Version zum Zeitpunkt dieses Schreibens ist.
EDIT 2:
ich versuchte, die Bibliothek statisch verlinkt werden, durch node_modules/scrypt/binding.gyp
Bearbeitung
'libraries': ['/package/host/localhost/gcc-5/lib64/libstdc++.so.6'],
zu jeder der vier angegebenen Ziele zugibt und dann node-gyp rebuild
läuft.
Ich habe auch versucht
'libraries': ['-L/package/host/localhost/gcc-5/lib64', '-lstdc++'],
dies zu ändern, die syntaktisch gültig zu sein scheint, auch, aber immer noch, es versucht, die Bibliothek aus dem falschen Weg zur Laufzeit zu laden.