natevw / node-rf24

Control nRF24L01+ wireless radio communications from a server with SPI/GPIO ports
12 stars 6 forks source link

Unable to built on Raspberry Pi(Raspbian) #1

Open lytvynenkosv opened 10 years ago

lytvynenkosv commented 10 years ago

Trying to build on Raspberry Pi but npm build return error:


> rf24@0.0.0 install /home/pi/node-rf24
> node-gyp rebuild

make: Entering directory `/home/pi/node-rf24/build'
  CXX(target) Release/obj.target/rf24/rf24-wrapper.o
../rf24-wrapper.cc: In static member function ‘static v8::Handle<v8::Value> Wrapper::Begin(const v8::Arguments&)’:
../rf24-wrapper.cc:150:82: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
/home/pi/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: error:   initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../rf24-wrapper.cc: In static member function ‘static v8::Handle<v8::Value> Wrapper::Listen(const v8::Arguments&)’:
../rf24-wrapper.cc:167:83: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
/home/pi/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: error:   initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../rf24-wrapper.cc: In static member function ‘static v8::Handle<v8::Value> Wrapper::Write(const v8::Arguments&)’:
../rf24-wrapper.cc:187:82: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
/home/pi/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: error:   initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../rf24-wrapper.cc: In static member function ‘static v8::Handle<v8::Value> Wrapper::Available(const v8::Arguments&)’:
../rf24-wrapper.cc:202:86: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
/home/pi/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: error:   initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../rf24-wrapper.cc: In static member function ‘static v8::Handle<v8::Value> Wrapper::Read(const v8::Arguments&)’:
../rf24-wrapper.cc:217:81: error: invalid conversion from ‘void (*)(uv_work_t*) {aka void (*)(uv_work_s*)}’ to ‘uv_after_work_cb {aka void (*)(uv_work_s*, int)}’ [-fpermissive]
/home/pi/.node-gyp/0.10.18/deps/uv/include/uv.h:1432:15: error:   initializing argument 4 of ‘int uv_queue_work(uv_loop_t*, uv_work_t*, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
make: *** [Release/obj.target/rf24/rf24-wrapper.o] Error 1
make: Leaving directory `/home/pi/node-rf24/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.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.6.11+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/node-rf24
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0

Nodejs version 10.0.18 npm version 1.3.8 Maybe it has some dependencies that not installed in my system?

natevw commented 10 years ago

Hmmm, no it looks like libuv changed already. I knew it some stuff was changing in 0.12 but it's odd that within 0.10.x it's giving you trouble.

I'll take a look to see if it's an easy fix, but note two things:

  1. The code as it sits isn't quite finished — no real return values are going back to JS, which is especially problematic with reading data from the radio
  2. Since the node.js and V8 internals are pretty unstable (and due to wanting to more easily support an additional platform) I'll likely be refactoring this to do most of the radio control in JS (via an SPI library).

Thanks for the report, and sorry this is not in a good shape right now. Hopefully more progress soon and happy for any feedback.

bennigraf commented 10 years ago

Just as a note: I'm doing a project which involves a raspberry pi and a nrf24l01+ and since this library here unfortunately isn't completely in shape yet ;-), I want to implement a "software driver" based on the spi module (and share it on github...). So unless you're really in the mood for it, you can wait for my implementation, it should be usable within a couple of weeks... Best, Benni.

natevw commented 10 years ago

Thanks for the heads up @bennigraf! Is there a good RasPi SPI library for node.js? The only ones I've found do blocking calls, so my plan was to first write a proper SPI binding that attempts to be compatible with another platform's likely JS API. Then this module would be pure JS and depend on that. But it sounds like you may be ahead of me on both.

bennigraf commented 10 years ago

@natevw Nope, not quite :-). I was going to go with node-spi (https://github.com/RussTheAerialist/node-spi) which is the blocking one, yet the author states that he wants to change that at some point. If you happen to write a better implementation I'll jump on this train, though!

natevw commented 10 years ago

As far as the OP goes, yes for whatever reason libuv added a "status" parameter to the callback, apparently mid-0.10.x — it'd be a fairly easy fix and I may just do it and finish up this branch.

However, I've got a new SPI library working and will likely start a new branch/repo building an nRF driver on top of it soon: https://github.com/natevw/pi-spi

natevw commented 10 years ago

Sorry, forgot to update this thread but pi-spi is working and I've been making progress on https://github.com/natevw/node-nrf built atop. I'm still not ruling out finishing this (or certainly happy to review pull requests that do so) but I'm hoping the other version becomes worth its differences.

bennigraf commented 10 years ago

Thanks for your work natevw! I wanted to let you guys know that I created a workable driver for the nrf as well, you can find it here: https://github.com/bennigraf/Lammps/tree/master/controller/soft-rf24 (unfortunately hidden inside another repo/project for now until I find out how to deal with submodules...). This isn't the most beautiful code you'll ever see, but I got it to work on the raspberry ;-). I consider switching to your spi library, I just need to wrap my head around the blocking/non-blocking topic and it's sideeffects. Feel free to try it out, use it, improve it or steal from it if you want!