abandonware / node-bluetooth-hci-socket

MIT License
42 stars 47 forks source link

Compile error on electron.js 11 #18

Closed tkomde closed 3 years ago

tkomde commented 3 years ago

I got the following error when I try to recompile this module (required from @abandonware/noble) with electron-rebuild. It was fine on electron10, but not on electron11. It seems to be caused by v8-internal.h change bundled with electron 11, but I'm not familiar with node-gyp configuration and couldn't figure out how to fix it myself.

Enviroments

I found it failed on RaspberrypiOS too.

Reproduction sequences

Here's how to reproduce it.

npm init -y
npm i --save-dev electron@beta electron-rebuild
npm i @abandonware/bluetooth-hci-socket
npx electron-rebuild

Errors

make: Entering directory '/home/xxx/tes3/node_modules/usb/build'
  CC(target) Release/obj.target/libusb/libusb/libusb/core.o
⠦ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
⠏ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
⠙ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/io.o
⠼ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
⠴ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
⠧ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
⠇ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
⠏ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
⠦ Building module: usb, Completed: 1  CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
⠧ Building module: usb, Completed: 1  AR(target) Release/obj.target/usb.a
  COPY Release/usb.a
⠇ Building module: usb, Completed: 1  CXX(target) Release/obj.target/usb_bindings/src/node_usb.o
⠙ Building module: usb, Completed: 1In file included from /home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8.h:30,
                 from ../src/node_usb.h:12,
                 from ../src/node_usb.cc:1:
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h:418:38: error: ‘remove_cv_t’ is not a member of ‘std’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                      ^~~~~~~~~~~
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h:418:38: note: suggested alternative: ‘remove_cv’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                      ^~~~~~~~~~~
                                      remove_cv
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h:418:38: error: ‘remove_cv_t’ is not a member of ‘std’
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h:418:38: note: suggested alternative: ‘remove_cv’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                      ^~~~~~~~~~~
                                      remove_cv
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h:418:50: error: template argument 2 is invalid
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                  ^
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h:418:63: error: ‘::Perform’ has not been declared
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                               ^~~~~~~
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8-internal.h:418:63: note: suggested alternative: ‘perror’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                               ^~~~~~~
                                                               perror
⠹ Building module: usb, Completed: 1In file included from ../src/node_usb.h:12,
                 from ../src/node_usb.cc:1:
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8.h: At global scope:
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8.h:9182:75: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
   void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
                                                                           ^
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/v8.h:9190:78: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
   void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
                                                                              ^
⠼ Building module: usb, Completed: 1In file included from ../src/helpers.h:3,
                 from ../src/node_usb.h:21,
                 from ../src/node_usb.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../src/node_usb.h:14,
                 from ../src/node_usb.cc:1:
../src/node_usb.cc: At global scope:
/home/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/node.h:613:43: warning: cast between incompatible function types from ‘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/xxx/tes3/node_modules/usb/11.0.0-beta.16/include/node/node.h:647:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/node_usb.cc:95:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(usb_bindings, Initialize)
 ^~~~~~~~~~~
../src/node_usb.cc: In function ‘void handleHotplug(std::pair<libusb_device*, libusb_hotplug_event>)’:
../src/node_usb.cc:151:58: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
                                                          ^
In file included from ../src/helpers.h:3,
                 from ../src/node_usb.h:21,
                 from ../src/node_usb.cc:1:
../node_modules/nan/nan.h:1001:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
../src/node_usb.cc:151:58: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
                                                          ^
In file included from ../src/helpers.h:3,
                 from ../src/node_usb.h:21,
                 from ../src/node_usb.cc:1:
../node_modules/nan/nan.h:1001:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
⠴ Building module: usb, Completed: 1make: *** [usb_bindings.target.mk:128: Release/obj.target/usb_bindings/src/node_usb.o] Error 1
tkomde commented 3 years ago

I found that this is caused by usb module's binding.gyp. Changing '-std=c++0x' to '-std=c++14' solves compilation problem.

Sorry.