octoblu / meshblu

Meshblu is a cross-protocol IoT machine-to-machine messaging system.
https://meshblu.readme.io/
MIT License
816 stars 181 forks source link

Errors during build (npm install) #76

Closed abhayghatpande closed 9 years ago

abhayghatpande commented 9 years ago

zeromq version used in code is old and breaks the build.

make: Entering directory `/home/abhay/meshblu/node_modules/mosca/node_modules/zm
q/build'
  CXX(target) Release/obj.target/zmq/binding.o
../binding.cc: In static member function ‘static void zmq::Socket::UV_MonitorCallback(uv_idle_t*, int)’:
../binding.cc:385:9: error: ‘zmq_event_t’ was not declared in this scope
../binding.cc:385:21: error: expected ‘;’ before ‘event’
../binding.cc:389:18: error: ‘event’ was not declared in this scope
make: *** [Release/obj.target/zmq/binding.o] Error 1
make: Leaving directory `/home/abhay/meshblu/node_modules/mosca/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/local/lib/node_modules/npm/node_
modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Linux 3.10.23-xxxx-std-ipv6-64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/b
in/node-gyp.js" "rebuild"
gyp ERR! cwd /home/abhay/meshblu/node_modules/mosca/node_modules/zmqgyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! zmq@2.6.0 install: `node-gyp rebuild`npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq@2.6.0 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.10.23-xxxx-std-ipv6-64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "rebuild"
npm ERR! cwd /home/abhay/meshblu                             
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/abhay/meshblu/npm-debug.log
npm ERR! not ok code 0
chrismatthieu commented 9 years ago

It looks like zmq is an optional dependency for Mosca (https://github.com/mcollina/mosca/blob/master/package.json#L96). Did it still install for you?

Copying the author: @mcollina

mcollina commented 9 years ago

zmq is optional, so it should not be an issue if it's not installed, just some bad errors on install.

abhayghatpande commented 9 years ago

I think it cropped up when I issued npm rebuild. I was missing some headers on my system initially, dns_sd.h and zmq.h. So after getting those in place, I tried to rebuild. But looks like that was a bad idea, because now I'm getting a bunch of errors on geoip-lite.

abhayghatpande commented 9 years ago

To solve the zmq issue, I used https://github.com/JustinTulloss/zeromq.node, sym-linked it to zmq, and changed the version to 2.8.0 in the package.json.

Please let me know if what I'm doing is not the way to go. I'm pretty much a noob at JS and Node.

chrismatthieu commented 9 years ago

geoip-lite is also an optional dependency. we use it to convert connected ip addresses to geocodes.

abhayghatpande commented 9 years ago

So is npm rebuild not the way to go? Am I not using it correctly?

When I saw the initial errors for the missing headers, I stopped the npm install process with a ctrl-c. Then used npm rebuild. What if I want to install the optional modules, like zmq or geoip-lite? How can I request them to be installed?

chrismatthieu commented 9 years ago

We normally deploy to Linux and Mac and have the gcc C compiler installed on the machine. npm install does the trick. These errors are expected without a C compiler; however, npm should still install everything else including the fallbacks where possible leaving out the optional dependencies.

abhayghatpande commented 9 years ago

I did a fresh git clone and npm install and everything worked. So I'm going to close this issue. But I'm afraid that someone else may run into similar issues if they have missing header files like I did.