zeromq.node icon indicating copy to clipboard operation
zeromq.node copied to clipboard

node-gyp rebuild fails

Open genderup opened this issue 11 years ago • 12 comments

Running npm install on this project https://github.com/meatspaces/meatspace-chat results in the following error, was told to notify author of this package. I first installed zeromq using these instructions

sudo apt-get install libtool autoconf automake uuid-dev build-essential cd ~ wget http://download.zeromq.org/zeromq-4.0.3.tar.gz tar zxvf zeromq-4.0.3.tar.gz && cd zeromq-4.0.3 ./configure make && make install

Error 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:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12) gyp ERR! System Linux 3.8.0-29-generic gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/michael/meatspace-chat/node_modules/zmq gyp ERR! node -v v0.10.24 gyp ERR! node-gyp -v v0.12.1 gyp ERR! not ok npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is most likely a problem with the zmq 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 their info via: npm ERR! npm owner ls zmq npm ERR! There is likely additional logging output above.

genderup avatar Jan 12 '14 01:01 genderup

Have you tried installing this with a v3 version of libzmq? v4 is currently not really tested afaik.

ronkorving avatar Jan 14 '14 06:01 ronkorving

I am having the same problem as @genderup. I downgraded to v3, but I'm still having the same issue.

rosshinkley avatar Jan 29 '14 23:01 rosshinkley

Same issue on a RedHat 6.5 x86_64 clean installation (only node, npm and ZeroMQ)

ZeroMQ v3.2.4 installed:

yum -y install zeromq3
Package zeromq3-3.2.4-1.el6.x86_64 already installed and latest version

Library found:

 ldconfig -v | grep -o -E '\s+libzmq.*'
      libzmq.so.3 -> libzmq.so.3.0.0

Calling:

npm install zmq

results in following error:

npm http GET https://registry.npmjs.org/zmq
npm http 304 https://registry.npmjs.org/zmq
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/set-immediate
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/set-immediate
npm http 304 https://registry.npmjs.org/bindings

> [email protected] install /root/node_modules/zmq
> node-gyp rebuild

make: Entering directory `/root/node_modules/zmq/build'
  CXX(target) Release/obj.target/zmq/binding.o
../binding.cc:28:17: warning: zmq.h: No such file or directory
../binding.cc: In function ‘const char* zmq::ErrorMessage()’:
../binding.cc:173: error: ‘zmq_errno’ was not declared in this scope
../binding.cc:173: error: ‘zmq_strerror’ was not declared in this scope
../binding.cc: In constructor ‘zmq::Context::Context(int)’:
../binding.cc:221: error: ‘zmq_init’ was not declared in this scope
../binding.cc: In member function ‘void zmq::Context::Close()’:
../binding.cc:233: error: ‘zmq_term’ was not declared in this scope
../binding.cc: In member function ‘bool zmq::Socket::IsReady()’:
../binding.cc:312: error: ‘zmq_pollitem_t’ was not declared in this scope
../binding.cc:312: error: expected ‘;’ before ‘item’
../binding.cc:313: error: ‘item’ was not declared in this scope
../binding.cc:313: error: ‘zmq_poll’ was not declared in this scope
../binding.cc:317: error: ‘ZMQ_POLLIN’ was not declared in this scope
../binding.cc: In constructor ‘zmq::Socket::Socket(zmq::Context*, int)’:
../binding.cc:431: error: ‘zmq_socket’ was not declared in this scope
../binding.cc:443: error: ‘ZMQ_FD’ was not declared in this scope
../binding.cc:443: error: ‘zmq_getsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::GetSockOpt(int) [with T = char*]’:
../binding.cc:497: error: ‘zmq_getsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::SetSockOpt(int, v8::Handle<v8::Value>) [with  char*]’:
../binding.cc:510: error: ‘zmq_setsockopt’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::GetSockOpt(const v8::Arguments&
../binding.cc:536: error: ‘zmq_strerror’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::SetSockOpt(const v8::Arguments&
../binding.cc:560: error: ‘zmq_strerror’ was not declared in this scope
../binding.cc: In static member function ‘static void zmq::Socket::UV_BindAsync(uv_work_t*)’:
../binding.cc:612: error: ‘zmq_bind’ was not declared in this scope
../binding.cc:613: error: ‘zmq_errno’ was not declared in this scope
../binding.cc: In static member function ‘static void zmq::Socket::UV_BindAsyncAfter(uv_work_t*)’:
../binding.cc:623: error: ‘zmq_strerror’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::BindSync(const v8::Arguments&)’
../binding.cc:652: error: ‘zmq_bind’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::Connect(const v8::Arguments&)’:
../binding.cc:750: error: ‘zmq_connect’ was not declared in this scope
../binding.cc: At global scope:
../binding.cc:802: error: expected type-specifier before ‘zmq_msg_t’
../binding.cc:834: error: expected type-specifier before ‘zmq_msg_t’
../binding.cc:839: error: ‘zmq_msg_t’ does not name a type
../binding.cc: In member function ‘v8::Local<v8::Value> zmq::Socket::IncomingMessage::GetBuffer()’:
../binding.cc:808: error: ‘zmq_msg_data’ was not declared in this scope
../binding.cc:808: error: ‘zmq_msg_size’ was not declared in this scope
../binding.cc: In constructor ‘zmq::Socket::IncomingMessage::MessageReference::MessageReference()’:
../binding.cc:825: error: ‘msg_’ was not declared in this scope
../binding.cc:825: error: ‘zmq_msg_init’ was not declared in this scope
../binding.cc: In destructor ‘zmq::Socket::IncomingMessage::MessageReference::~MessageReference()’:
../binding.cc:830: error: ‘msg_’ was not declared in this scope
../binding.cc:830: error: ‘zmq_msg_close’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::Recv(const v8::Arguments&)’:
../binding.cc:900: error: ‘zmq_recvmsg’ was not declared in this scope
../binding.cc: At global scope:
../binding.cc:928: error: expected type-specifier before ‘zmq_msg_t’
../binding.cc:968: error: ‘zmq_msg_t’ does not name a type
../binding.cc: In constructor ‘zmq::Socket::OutgoingMessage::OutgoingMessage(v8::Handle<v8::Object>)’:
../binding.cc:916: error: ‘msg_’ was not declared in this scope
../binding.cc:917: error: ‘zmq_msg_init_data’ was not declared in this scope
../binding.cc: In destructor ‘zmq::Socket::OutgoingMessage::~OutgoingMessage()’:
../binding.cc:924: error: ‘msg_’ was not declared in this scope
../binding.cc:924: error: ‘zmq_msg_close’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::Send(const v8::Arguments&)’:
../binding.cc:998: error: ‘zmq_msg_t’ was not declared in this scope
../binding.cc:998: error: expected ‘;’ before ‘msg’
../binding.cc:1001: error: ‘msg’ was not declared in this scope
../binding.cc:1001: error: ‘zmq_msg_init_size’ was not declared in this scope
../binding.cc:1005: error: ‘zmq_msg_data’ was not declared in this scope
../binding.cc:1013: error: ‘zmq_sendmsg’ was not declared in this scope
../binding.cc: In member function ‘void zmq::Socket::Close()’:
../binding.cc:1025: error: ‘zmq_close’ was not declared in this scope
../binding.cc: In function ‘v8::Handle<v8::Value> zmq::ZmqVersion(const v8::Arguments&)’:
../binding.cc:1061: error: ‘zmq_version’ was not declared in this scope
../binding.cc: In function ‘void zmq::Initialize(v8::Handle<v8::Object>)’:
../binding.cc:1129: error: ‘ZMQ_VERSION_MAJOR’ was not declared in this scope
../binding.cc:1129: error: ‘ZMQ_VERSION_MINOR’ was not declared in this scope
../binding.cc:1131: error: ‘ZMQ_VERSION’ was not declared in this scope
../binding.cc:1132: error: ‘ZMQ_PUB’ was not declared in this scope
../binding.cc:1133: error: ‘ZMQ_SUB’ was not declared in this scope
../binding.cc:1138: error: ‘ZMQ_REQ’ was not declared in this scope
../binding.cc:1139: error: ‘ZMQ_XREQ’ was not declared in this scope
../binding.cc:1140: error: ‘ZMQ_REP’ was not declared in this scope
../binding.cc:1141: error: ‘ZMQ_XREP’ was not declared in this scope
../binding.cc:1144: error: ‘ZMQ_PUSH’ was not declared in this scope
../binding.cc:1145: error: ‘ZMQ_PULL’ was not declared in this scope
../binding.cc:1146: error: ‘ZMQ_PAIR’ was not declared in this scope
../binding.cc:1148: error: ‘ZMQ_POLLIN’ was not declared in this scope
../binding.cc:1149: error: ‘ZMQ_POLLOUT’ was not declared in this scope
../binding.cc:1150: error: ‘ZMQ_POLLERR’ was not declared in this scope
../binding.cc:1152: error: ‘ZMQ_SNDMORE’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::GetSockOpt(int) [with T = int]’:
../binding.cc:526:   instantiated from here
../binding.cc:477: error: ‘zmq_getsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::GetSockOpt(int) [with T = unsigned int]’:
../binding.cc:528:   instantiated from here
../binding.cc:477: error: ‘zmq_getsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::GetSockOpt(int) [with T = long int]’:
../binding.cc:530:   instantiated from here
../binding.cc:477: error: ‘zmq_getsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::GetSockOpt(int) [with T = long unsigned int]’
../binding.cc:532:   instantiated from here
../binding.cc:477: error: ‘zmq_getsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::SetSockOpt(int, v8::Handle<v8::Value>) [with  int]’:
../binding.cc:550:   instantiated from here
../binding.cc:488: error: ‘zmq_setsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::SetSockOpt(int, v8::Handle<v8::Value>) [with  unsigned int]’:
../binding.cc:552:   instantiated from here
../binding.cc:488: error: ‘zmq_setsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::SetSockOpt(int, v8::Handle<v8::Value>) [with  long int]’:
../binding.cc:554:   instantiated from here
../binding.cc:488: error: ‘zmq_setsockopt’ was not declared in this scope
../binding.cc: In member function ‘v8::Handle<v8::Value> zmq::Socket::SetSockOpt(int, v8::Handle<v8::Value>) [with  long unsigned int]’:
../binding.cc:556:   instantiated from here
../binding.cc:488: error: ‘zmq_setsockopt’ was not declared in this scope
make: *** [Release/obj.target/zmq/binding.o] Error 1
make: Leaving directory `/root/node_modules/zmq/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/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 2.6.32-431.11.2.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/node_modules/zmq
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0

Are there any prerequisites apart from installing ZeroMQ?

luscus avatar Apr 22 '14 07:04 luscus

All the information should be in the wiki: https://github.com/JustinTulloss/zeromq.node/wiki/Installation

ronkorving avatar Apr 22 '14 09:04 ronkorving

Thanks for the hint @ronkorving. For RedHat you have to install following packages:

echo '  - Install ZeroMQ'
yum -y install zeromq3
yum -y install zeromq3-devel

luscus avatar Apr 22 '14 11:04 luscus

I have the same issue on Ubuntu 14.04.

apt-get install -y uuid-dev libtool autoconf automake make g++

wget http://download.zeromq.org/zeromq-3.2.4.tar.gz --no-check-certificate &&\
    tar xzf zeromq-3.2.4.tar.gz

mv zeromq-3.2.4 /zmq

cd /zmq && ./configure && make install && ldconfig

apt-get install -y software-properties-common python-software-properties
add-apt-repository -y ppa:chris-lea/zeromq
add-apt-repository -y ppa:chris-lea/libpgm
apt-get update
apt-get install -y libzmq3-dev libzmq-dev

npm install zmq -g

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1046:12)
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "node" "node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node/lib/node_modules/zmq
gyp ERR! node -v v0.11.13
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the zmq 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 their info via:
npm ERR!     npm owner ls zmq
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/node/bin/node" "/node/bin/npm" "install" "zmq" "-g"
npm ERR! cwd /
npm ERR! node -v v0.11.13
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /npm-debug.log
npm ERR! not ok code 0

I also tried pulling down your repository and configuring/building it myself with node-gyp.

wget https://github.com/JustinTulloss/zeromq.node/archive/2.7.0.tar.gz
tar xvf 2.7.0.tar.gz
mv zeromq.node-2.7.0 zmq
cd zmq
node-gyp configure
node-gyp build

I end up with the same error, probably because I'm manually doing exactly what npm is doing. I also see lots of errors like

In file included from ../binding.cc:24:0:
/.node-gyp/0.11.13/deps/v8/include/v8.h:336:28: note: declared here
   friend Handle<Primitive> Undefined(Isolate* isolate);

during the build which leaves me to believe I'm missing a dependency. I have this setup just fine on Ubuntu 12.10 with node 0.10.x.

All of this is running as root.

mneil avatar Jun 27 '14 18:06 mneil

Has to do 100% with node 0.11. Just rebuilt under 10 and went through just fine. And, actually, none of this was required:

apt-get install -y software-properties-common python-software-properties
add-apt-repository -y ppa:chris-lea/zeromq
add-apt-repository -y ppa:chris-lea/libpgm
apt-get update
apt-get install -y libzmq3-dev libzmq-dev

mneil avatar Jun 27 '14 18:06 mneil

Having the same issue with zmq 3 and 4.

I had a similar issue with another node library, and the fix outlined here didn't work for zmq.

node -v
v0.10.28

I also followed the process outlined in this thread and tried brew install zmq

facultymatt avatar Jul 01 '14 00:07 facultymatt

Possibly unrelated to the thread question, but to confirm @mneil comments regarding out of the box Node versions and increasingly failing v8 deps for zeromq.node -

MacOSX 10.9.3 ZeroMQ 4.0.4 ZeroMQ.node 2.7.0: npm install zmq:

  • Node: 0.10.29: perfect install
  • Node: 0.11.6: 2 warnings (see below), completes installation (untested)
  • Node 0.11.13: Multiple failures (errors), install bails out

0.11.6 output:

  CXX(target) Release/obj.target/zmq/binding.o
../binding.cc:967:13: warning: 'MakeWeak' is deprecated [-Wdeprecated-declarations]
            NanMakeWeak(buf_, this, &WeakCheck);
            ^
../node_modules/nan/nan.h:316:12: note: expanded from macro 'NanMakeWeak'
    handle.MakeWeak(nan_isolate, parameter, callback)
           ^
/Users/cayuu/.node-gyp/0.11.6/deps/v8/include/v8.h:664:22: note: 'MakeWeak' declared here
  V8_DEPRECATED(void MakeWeak(
                     ^
/Users/cayuu/.node-gyp/0.11.6/deps/v8/include/v8.h:91:35: note: expanded from macro
      'V8_DEPRECATED'
#define V8_DEPRECATED(declarator) declarator __attribute__ ((deprecated))
                                  ^
../binding.cc:987:14: warning: 'MakeWeak' is deprecated [-Wdeprecated-declarations]
             NanMakeWeak(NAN_WEAK_CALLBACK_OBJECT, NAN_WEAK_CALLBACK_DATA(BufferRe...
             ^
../node_modules/nan/nan.h:316:12: note: expanded from macro 'NanMakeWeak'
    handle.MakeWeak(nan_isolate, parameter, callback)
           ^
/Users/cayuu/.node-gyp/0.11.6/deps/v8/include/v8.h:664:22: note: 'MakeWeak' declared here
  V8_DEPRECATED(void MakeWeak(
                     ^
/Users/cayuu/.node-gyp/0.11.6/deps/v8/include/v8.h:91:35: note: expanded from macro
      'V8_DEPRECATED'
#define V8_DEPRECATED(declarator) declarator __attribute__ ((deprecated))
                                  ^
2 warnings generated.
  SOLINK_MODULE(target) Release/zmq.node
ld: warning: directory not found for option '-L/opt/local/lib'
  SOLINK_MODULE(target) Release/zmq.node: Finished
[email protected] node_modules/zmq

cayuu avatar Jul 15 '14 19:07 cayuu

Hi is there a solution now?

I tried to install zmq on windows 10 with up to date node.js and npm

But there occur this error: C:\Users\xxx\AppData\Roaming\npm\node_modules\zmq>if not defined npm_config_node_gyp (node "C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild ) Traceback (most recent call last): File "C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 13, in import gyp File "C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 8, in import gyp.input File "C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 891 except ImportError as e: ^ SyntaxError: invalid syntax gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:308:16) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Windows_NT 10.0.14393 gyp ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\xxx\AppData\Roaming\npm\node_modules\zmq gyp ERR! node -v v6.10.1 gyp ERR! node-gyp -v v3.5.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 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! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the zmq 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 zmq npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls zmq npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

ChangeTheCode avatar Mar 23 '17 14:03 ChangeTheCode

@ChangeTheCode You can try zeromq.js which has the same API as zmq but ships with prebuilt binaries for Windows, Linux and OS X for easy installation.

lgeiger avatar Mar 23 '17 14:03 lgeiger

Thank you very much. zeromq.js works !!

ChangeTheCode avatar Mar 23 '17 15:03 ChangeTheCode