meg768 / rpi-ws281x

rpi-ws281x
22 stars 26 forks source link

Install failure of rpi-ws281x on Raspbian buster , running on Pi 4B #9

Closed ajmas closed 3 years ago

ajmas commented 3 years ago

I am running into an install failure, which seems related to the node-gyp version being used.

What's going wrong

When I run npm install rpi-ws281x I get the following output (full output here):

> rpi-ws281x@1.0.34 install /home/ajmas/projects/ws281-js/node_modules/rpi-ws281x
> node-gyp rebuild

make: Entering directory '/home/ajmas/projects/ws281-js/node_modules/rpi-ws281x/build'
  CXX(target) Release/obj.target/rpi-ws281x/src/addon.o
../src/addon.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Addon::configure(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cpp:67:93: warning: ‘v8::Local<v8::Value> v8::Object::Get(v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
     v8::Local<v8::Value> debug = options->Get(Nan::New<v8::String>("debug").ToLocalChecked());
                                                                                             ^
In file included from /home/ajmas/.cache/node-gyp/12.19.1/include/node/v8-internal.h:14,
                 from /home/ajmas/.cache/node-gyp/12.19.1/include/node/v8.h:27,
                 from /home/ajmas/.cache/node-gyp/12.19.1/include/node/node.h:67,
                 from ../../nan/nan.h:56,
                 from ../src/addon.h:5,
                 from ../src/addon.cpp:1:
/home/ajmas/.cache/node-gyp/12.19.1/include/node/v8.h:3553:51: note: declared here
   V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
                                                   ^~~
/home/ajmas/.cache/node-gyp/12.19.1/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/addon.cpp:72:95: warning: ‘v8::Local<v8::Value> v8::Object::Get(v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         v8::Local<v8::Value> leds = options->Get(Nan::New<v8::String>("leds").ToLocalChecked());
                                                                                               ^
In file included from /home/ajmas/.cache/node-gyp/12.19.1/include/node/v8-internal.h:14,
                 from /home/ajmas/.cache/node-gyp/12.19.1/include/node/v8.h:27,
                 from /home/ajmas/.cache/node-gyp/12.19.1/include/node/node.h:67,
                 from ../../nan/nan.h:56,
                 from ../src/addon.h:5,
                 from ../src/addon.cpp:1:
/home/ajmas/.cache/node-gyp/12.19.1/include/node/v8.h:3553:51: note: declared here
   V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
                                                   ^~~
/home/ajmas/.cache/node-gyp/12.19.1/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/addon.cpp:83:93: warning: ‘v8::Local<v8::Value> v8::Object::Get(v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         v8::Local<v8::Value> dma = options->Get(Nan::New<v8::String>("dma").ToLocalChecked());

Environment

BTW Just saw issue #6. I'll see if this is the same issue, but would be good to see this updated to support more recent version of NodeJS, if this is the case.

ajmas commented 3 years ago

So there seems to be some API changes. I am taking a look to see what changes need to be made, but not really that versed in the V8 API and I am rusting in C++. I'll make notes on some observed changes that to be made (partly with reference to https://github.com/bcoin-org/bcrypto/issues/7), as I see what they are:

meg768 commented 3 years ago

True, Int32Value() is obsolete I think. Data type conversions in V8 is a mess. Open for suggestions.

ajmas commented 3 years ago

These changes seem to work. Running the following now fills half the matrix with LEDs in red:

sudo node examples/fill-with-color.js

Ah there is another possible replacement for Int32Value(), which I'll try:

int32_t arg = info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value();

Confirms this works too. I'll make a PR a bit late, if welcome.

meg768 commented 3 years ago

OK, error 2?

ajmas commented 3 years ago

Resolved as well, using this alternative:

v8::String::Utf8Value value(v8::Isolate::GetCurrent(), Nan::To<v8::String>(stripType).ToLocalChecked());

meg768 commented 3 years ago

Make a pull request and I will publish a new version on npm. Thank you!

SimonGAndrews commented 3 years ago

Will be watching to give this a test, when published. Thanks very much, ajmas, been struggling to get an upto date library for neo pixel in node. Cheers.

ajmas commented 3 years ago

I may need to make a new PR later, based on some new information provided to me on Stack Overflow, though if anyone has time they are welcome to do so as well.

meg768 commented 3 years ago

No worries, just let me know and I will publish a new version on npm...