2016-07-10 6 views
0

Ich habe Probleme bei der Installation von Nodejs-Bibliotheken, die auf Centos 6.8 kompiliert werden müssen. sieht so aus, als ob die Abhängigkeiten von Knoten v4 mit der neueren Version von gcc-C++ kompiliert werden sollten. Ich habe wie in zahlreichen Posts vorgeschlagen, devtoolset v3 installiert, um gcc-4.9 verwenden zu können. Aber es schlägt immer noch mit denselben Fehlermeldungen fehl, was darauf hindeutet, dass ich immer noch einen Compiler verwende, der C++ 11 nicht unterstützt. Ich habe strace und es sieht aus wie devtools nicht libgcc bereitzustellen, wo Installationsprozess zu finden erwartet, so dass es endet die reguläre Einnahme, die gcc-4,4Kompilieren für Nodejs v4 auf Centos 6.8

Setup ist:

[[email protected] sflow]$ cat /etc/centos-release 
CentOS release 6.8 (Final) 
[[email protected] sflow]$ node -v 
v4.4.7 
[[email protected] sflow]$ npm -v 
2.15.8 

ohne devtoolset:

[[email protected] sflow]$ g++ -v 
Using built-in specs. 
Target: x86_64-redhat-linux 
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 
Thread model: posix 
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 

npm installieren

[[email protected] sflow]$ npm instal --save pcap2 
npm WARN package.json [email protected] No description 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No README data 
\ 
> [email protected] install /home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher 
> node-gyp rebuild 

make: Entering directory `/home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher/build' 
    CXX(target) Release/obj.target/socketwatcher/socket_watcher.o 
In file included from ../socket_watcher.hpp:8, 
       from ../socket_watcher.cpp:5: 
../../nan/nan.h:43:3: error: #error This version of node/NAN/v8 requires a C++11 compiler 
In file included from /home/vagrant/.node-gyp/4.4.7/include/node/node.h:42, 
       from ../../nan/nan.h:47, 
       from ../socket_watcher.hpp:8, 
       from ../socket_watcher.cpp:5: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:336: error: expected unqualified-id before ‘using’ 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In constructor ‘v8::MaybeLocal<T>::MaybeLocal()’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:353: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘bool v8::MaybeLocal<T>::IsEmpty() const’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:360: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘bool v8::MaybeLocal<T>::ToLocal(v8::Local<S>*) const’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:364: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘bool v8::WeakCallbackInfo<T>::IsFirstPass() const’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:430: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: At global scope: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:469: error: expected unqualified-id before ‘using’ 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In constructor ‘v8::Global<T>::Global()’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:790: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In constructor ‘v8::Global<T>::Global(v8::Global<T>&&)’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:815: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘v8::Global<T>& v8::Global<T>::operator=(v8::Global<S>&&)’: 
... skipped ... 
../../nan/nan.h:2256: error: expected unqualified-id before ‘>’ token 
../../nan/nan.h:2265: error: expected constructor, destructor, or type conversion before ‘<’ token 
../socket_watcher.cpp: In static member function ‘static void SocketWatcher::Initialize(v8::Local<v8::Object>)’: 
../socket_watcher.cpp:22: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’ 
../socket_watcher.cpp:30: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’ 
../socket_watcher.cpp: In static member function ‘static void SocketWatcher::Callback(uv_poll_t*, int, int)’: 
../socket_watcher.cpp:62: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’ 
../socket_watcher.cpp:63: error: ‘Get’ is not a member of ‘Nan’ 
make: *** [Release/obj.target/socketwatcher/socket_watcher.o] Error 1 
make: Leaving directory `/home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher/build' 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) 
gyp ERR! stack  at emitTwo (events.js:87:13) 
gyp ERR! stack  at ChildProcess.emit (events.js:172:7) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) 
gyp ERR! System Linux 2.6.32-642.el6.x86_64 
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher 
gyp ERR! node -v v4.4.7 
gyp ERR! node-gyp -v v3.3.1 
gyp ERR! not ok 
npm ERR! Linux 2.6.32-642.el6.x86_64 
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "instal" "--save" "pcap2" 
npm ERR! node v4.4.7 
npm ERR! npm v2.15.8 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
npm ERR! This is most likely a problem with the socketwatcher package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node-gyp rebuild 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs socketwatcher 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! 
npm ERR!  npm owner ls socketwatcher 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /home/vagrant/sflow/npm-debug.log 

devtoolset:

[[email protected] sflow]$ scl enable python27 devtoolset-3 bash 
[[email protected] sflow]$ g++ -v 
Using built-in specs. 
COLLECT_GCC=g++ 
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper 
Target: x86_64-redhat-linux 
Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 
Thread model: posix 
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC) 

npm installieren

[[email protected] sflow]$ npm install --save pcap2 
npm WARN package.json [email protected] No description 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No README data 
- 
> [email protected] install /home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher 
> node-gyp rebuild 

make: Entering directory `/home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher/build' 
    CXX(target) Release/obj.target/socketwatcher/socket_watcher.o 
In file included from ../socket_watcher.hpp:8, 
       from ../socket_watcher.cpp:5: 
../../nan/nan.h:43:3: error: #error This version of node/NAN/v8 requires a C++11 compiler 
In file included from /home/vagrant/.node-gyp/4.4.7/include/node/node.h:42, 
       from ../../nan/nan.h:47, 
       from ../socket_watcher.hpp:8, 
       from ../socket_watcher.cpp:5: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:336: error: expected unqualified-id before ‘using’ 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In constructor ‘v8::MaybeLocal<T>::MaybeLocal()’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:353: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘bool v8::MaybeLocal<T>::IsEmpty() const’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:360: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘bool v8::MaybeLocal<T>::ToLocal(v8::Local<S>*) const’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:364: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘bool v8::WeakCallbackInfo<T>::IsFirstPass() const’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:430: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: At global scope: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:469: error: expected unqualified-id before ‘using’ 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In constructor ‘v8::Global<T>::Global()’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:790: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In constructor ‘v8::Global<T>::Global(v8::Global<T>&&)’: 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h:815: error: ‘nullptr’ was not declared in this scope 
/home/vagrant/.node-gyp/4.4.7/include/node/v8.h: In member function ‘v8::Global<T>& v8::Global<T>::operator=(v8::Global<S>&&)’: 
... skipped ... 
../../nan/nan.h:2256: error: ‘MaybeLocal’ was not declared in this scope 
../../nan/nan.h:2256: error: template argument 1 is invalid 
../../nan/nan.h:2256: error: expected unqualified-id before ‘>’ token 
../../nan/nan.h:2265: error: expected constructor, destructor, or type conversion before ‘<’ token 
../socket_watcher.cpp: In static member function ‘static void SocketWatcher::Initialize(v8::Local<v8::Object>)’: 
../socket_watcher.cpp:22: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’ 
../socket_watcher.cpp:30: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’ 
../socket_watcher.cpp: In static member function ‘static void SocketWatcher::Callback(uv_poll_t*, int, int)’: 
../socket_watcher.cpp:62: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’ 
../socket_watcher.cpp:63: error: ‘Get’ is not a member of ‘Nan’ 
make: *** [Release/obj.target/socketwatcher/socket_watcher.o] Error 1 
make: Leaving directory `/home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher/build' 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) 
gyp ERR! stack  at emitTwo (events.js:87:13) 
gyp ERR! stack  at ChildProcess.emit (events.js:172:7) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) 
gyp ERR! System Linux 2.6.32-642.el6.x86_64 
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /home/vagrant/sflow/node_modules/pcap2/node_modules/socketwatcher 
gyp ERR! node -v v4.4.7 
gyp ERR! node-gyp -v v3.3.1 
gyp ERR! not ok 
npm ERR! Linux 2.6.32-642.el6.x86_64 
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--save" "pcap2" 
npm ERR! node v4.4.7 
npm ERR! npm v2.15.8 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
npm ERR! This is most likely a problem with the socketwatcher package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node-gyp rebuild 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs socketwatcher 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! 
npm ERR!  npm owner ls socketwatcher 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /home/vagrant/sflow/npm-debug.log 

strace:

[[email protected] sflow]$ strace npm install --save pcap2 > strace.log 2>&1 
[[email protected] sflow]$ grep gcc strace.log 
open("/opt/rh/devtoolset-3/root/usr/lib64/tls/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 
open("/opt/rh/devtoolset-3/root/usr/lib64/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 
open("/opt/rh/devtoolset-3/root/usr/lib/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 
open("/opt/rh/python27/root/usr/lib64/tls/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 
open("/opt/rh/python27/root/usr/lib64/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) 
open("/lib64/libgcc_s.so.1", O_RDONLY) = 3 

Knoten-gyp

[[email protected] sflow]$ g++ -v 
Using built-in specs. 
COLLECT_GCC=g++ 
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper 
Target: x86_64-redhat-linux 
Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 
Thread model: posix 
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC) 
[[email protected] sflow]$ env CXX="g++ -v" node-gyp rebuild 
gyp info it worked if it ends with ok 
gyp info using [email protected] 
gyp info using [email protected] | linux | x64 
gyp info spawn /opt/rh/python27/root/usr/bin/python2 
gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py', 
gyp info spawn args 'binding.gyp', 
gyp info spawn args '-f', 
gyp info spawn args 'make', 
gyp info spawn args '-I', 
gyp info spawn args '/home/vagrant/sflow/build/config.gypi', 
gyp info spawn args '-I', 
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi', 
gyp info spawn args '-I', 
gyp info spawn args '/home/vagrant/.node-gyp/4.4.7/include/node/common.gypi', 
gyp info spawn args '-Dlibrary=shared_library', 
gyp info spawn args '-Dvisibility=default', 
gyp info spawn args '-Dnode_root_dir=/home/vagrant/.node-gyp/4.4.7', 
gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp', 
gyp info spawn args '-Dnode_lib_file=node.lib', 
gyp info spawn args '-Dmodule_root_dir=/home/vagrant/sflow', 
gyp info spawn args '--depth=.', 
gyp info spawn args '--no-parallel', 
gyp info spawn args '--generator-output', 
gyp info spawn args 'build', 
gyp info spawn args '-Goutput_dir=.' ] 
gyp: binding.gyp not found (cwd: /home/vagrant/sflow) while trying to load binding.gyp 
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1 
gyp ERR! stack  at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:305:16) 
gyp ERR! stack  at emitTwo (events.js:87:13) 
gyp ERR! stack  at ChildProcess.emit (events.js:172:7) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) 
gyp ERR! System Linux 2.6.32-642.el6.x86_64 
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" 
gyp ERR! cwd /home/vagrant/sflow 
gyp ERR! node -v v4.4.7 
gyp ERR! node-gyp -v v3.4.0 
gyp ERR! not ok 

so wieder aufzubauen, die Frage ist - was ich bei der Anwendung devtoolset bin fehlt centos6 zu verwenden gcc-4.9 auf? oder gibt es einen anderen Weg zu Knoten v4 und pcap2 auf Centos6?

+1

Ist die tatsächliche Installation fehlschlagen? Was ist die tatsächliche Ausgabe des Befehls 'npm', den Sie ausführen möchten? Die Suche nach 'libgcc_s.so.1' in verschiedenen Verzeichnissen ist nicht wirklich das Problem hier, denke ich, es ist ein Ablenkungsmanöver. Bitte zeigen Sie uns die tatsächliche Ausgabe des Befehls 'npm'. –

+0

@JoachimPileborg, fertig. – ilj

+0

Das Problem hier ist Ihre Version von GCC. Version 4.4.7 ist einfach zu alt, um C++ 11 zu unterstützen. –

Antwort

1

Ein C++ 11-kompatibler Compiler ist erforderlich (z. B. gcc 4.8 oder höher). In der node-gyp rebuild Ausgabe am Ende Ihres Beitrags sieht es immer noch nicht so aus, als wäre Ihre 4.9.2-Installation abgeholt worden. Sie können explizite Pfade zu den richtigen gcc/g ++ - Binärdateien mit setzen.

(ursprünglich ein Kommentar, jetzt als Antwort gepostet.)