Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ajmas opened this issue Nov 22, 2020 · 9 comments
Closed

Comments

@ajmas
Copy link
Contributor

ajmas commented Nov 22, 2020

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

  • OS, per lsb_release -a:
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
Codename:	buster
  • uname: Linux bluepenguin 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux
  • NodeJS: v12.19.1

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
Copy link
Contributor Author

ajmas commented Nov 22, 2020

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 bcoin-org/bcrypto#7), as I see what they are:

  • Error 1:
    usleep(info[0]->Int32Value() * 1000);
    Needs to be replaced with:
    usleep(info[0]->Int32Value(Nan::GetCurrentContext()).FromJust() * 1000);

  • Error 2:
    v8::String::Utf8Value value(stripType->ToString())
    Need to be replaced with (using this as reference):
    v8::String::Utf8Value value(v8::Isolate::GetCurrent(), Nan::To<v8::String>(stripType).ToLocalChecked());

@meg768
Copy link
Owner

meg768 commented Nov 22, 2020

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

@ajmas
Copy link
Contributor Author

ajmas commented Nov 22, 2020

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
Copy link
Owner

meg768 commented Nov 22, 2020

OK, error 2?

@ajmas
Copy link
Contributor Author

ajmas commented Nov 22, 2020

Resolved as well, using this alternative:

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

@meg768
Copy link
Owner

meg768 commented Nov 22, 2020

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

@SimonGAndrews
Copy link

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.

@meg768 meg768 closed this as completed in 2ea7279 Nov 23, 2020
meg768 added a commit that referenced this issue Nov 23, 2020
@ajmas
Copy link
Contributor Author

ajmas commented Nov 23, 2020

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
Copy link
Owner

meg768 commented Nov 23, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants