meg768 / rpi-ws281x

rpi-ws281x
22 stars 26 forks source link

"‘GetFunction’ was not declared in this scope" on Raspberry Pi Zero #17

Open osiris86 opened 3 years ago

osiris86 commented 3 years ago

I'm trying to use the module on a Pi Zero with recent Pi OS.

I've various NodeJS versions (12.22.1, 11.15.0, 10.24.1, 8.17.0), all with the same error:

> rpi-ws281x-native@1.0.3 install /home/pi/mirror-udp-server/node_modules/rpi-ws281x-native
> node-gyp rebuild -j4 --release

make: Verzeichnis „/home/pi/mirror-udp-server/node_modules/rpi-ws281x-native/build“ wird betreten
  ACTION binding_gyp_rpi_ws281x_version_target_make_version_h src/rpi_ws281x/version.h
  TOUCH Release/obj.target/rpi_ws281x-version.stamp
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/dma.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/mailbox.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/pcm.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/pwm.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/rpihw.o
  CC(target) Release/obj.target/rpi_libws2811/src/rpi_ws281x/ws2811.o
  AR(target) Release/obj.target/rpi_libws2811.a
  COPY Release/rpi_libws2811.a
  CXX(target) Release/obj.target/rpi_ws281x/src/rpi-ws281x.o
../src/rpi-ws281x.cc: In function ‘void InitAll(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’:
../src/rpi-ws281x.cc:229:5: error: ‘GetFunction’ was not declared in this scope
     GetFunction(Nan::New<FunctionTemplate>(init)).ToLocalChecked());
     ^~~~~~~~~~~
../src/rpi-ws281x.cc:229:5: note: suggested alternative:
In file included from ../../nan/nan.h:284,
                 from ../src/rpi-ws281x.cc:1:
../../nan/nan_maybe_43_inl.h:66:33: note:   ‘Nan::GetFunction’
 inline MaybeLocal<v8::Function> GetFunction(
                                 ^~~~~~~~~~~
../src/rpi-ws281x.cc:232:44: error: ‘setBrightness’ was not declared in this scope
     GetFunction(Nan::New<FunctionTemplate>(setBrightness)).ToLocalChecked());
                                            ^~~~~~~~~~~~~
../src/rpi-ws281x.cc:235:44: error: ‘reset’ was not declared in this scope
     GetFunction(Nan::New<FunctionTemplate>(reset)).ToLocalChecked());
                                            ^~~~~
../src/rpi-ws281x.cc:235:44: note: suggested alternative: ‘tzset’
     GetFunction(Nan::New<FunctionTemplate>(reset)).ToLocalChecked());
                                            ^~~~~
                                            tzset
In file included from ../../nan/nan.h:56,
                 from ../src/rpi-ws281x.cc:1:
../src/rpi-ws281x.cc: At global scope:
/home/pi/.node-gyp/11.15.0/include/node/node.h:544:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/pi/.node-gyp/11.15.0/include/node/node.h:578:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/rpi-ws281x.cc:244:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(addon, InitAll)
 ^~~~~~~~~~~
In file included from /home/pi/.node-gyp/11.15.0/include/node/node.h:63,
                 from ../../nan/nan.h:56,
                 from ../src/rpi-ws281x.cc:1:
/home/pi/.node-gyp/11.15.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/pi/.node-gyp/11.15.0/include/node/node_object_wrap.h:84:78:   required from here
/home/pi/.node-gyp/11.15.0/include/node/v8.h:9710:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/.node-gyp/11.15.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/home/pi/.node-gyp/11.15.0/include/node/v8.h:9710:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]

Raspian Version:

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Any hints would be highly appreciated