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

Library not compatible with node >= 8.x | cannot rebuild bluetooth-hci-socket dependency #114

Open
gotgot1995 opened this issue Sep 24, 2022 · 0 comments

Comments

@gotgot1995
Copy link

gotgot1995 commented Sep 24, 2022

Hi, I tried to use this library that I used a few years ago but using a more recent version of nodejs such as 16.17.1 and it doesn't seem to work anymore.
In my case, I get the following error:

Error: Cannot find module 'bluetooth-hci-socket'

So I tried running npm install bluetooth-hci-socket manually but it looks like node-gyp cannot rebuild that package:

npm ERR! code 1
npm ERR! path /home/gautier/Documents/Projects/temp-monitor/node_modules/bluetooth-hci-socket
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! make : on entre dans le répertoire « /home/gautier/Documents/Projects/temp-monitor/node_modules/bluetooth-hci-socket/build »
npm ERR!   CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
npm ERR! make : on quitte le répertoire « /home/gautier/Documents/Projects/temp-monitor/node_modules/bluetooth-hci-socket/build »
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/gautier/Documents/Projects/temp-monitor/node_modules/bluetooth-hci-socket/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/gautier/.cache/node-gyp/16.17.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/gautier/.cache/node-gyp/16.17.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/gautier/.cache/node-gyp/16.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/gautier/Documents/Projects/temp-monitor/node_modules/bluetooth-hci-socket',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static void BluetoothHciSocket::Init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’:
npm ERR! ../src/BluetoothHciSocket.cpp:128:82: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
npm ERR!   128 |   target->Set(Nan::New("BluetoothHciSocket").ToLocalChecked(), tmpl->GetFunction());
npm ERR!       |                                                                                  ^
npm ERR! In file included from /home/gautier/.cache/node-gyp/16.17.1/include/node/node.h:73,
npm ERR!                  from /home/gautier/.cache/node-gyp/16.17.1/include/node/node_buffer.h:25,
npm ERR!                  from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:6802:46: note: candidate: ‘v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)’
npm ERR!  6802 |   V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
npm ERR!       |                                              ^~~~~~~~~~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:6802:46: note:   candidate expects 1 argument, 0 provided
npm ERR! ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’:
npm ERR! ../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   251 |     Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
npm ERR!       |                                                                                               ^
npm ERR! In file included from ../src/BluetoothHciSocket.cpp:8:
npm ERR! ../../nan/nan.h:1051:46: note: declared here
npm ERR!  1051 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError()’:
npm ERR! ../src/BluetoothHciSocket.cpp:269:109: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>)’
npm ERR!   269 |   Local<Function> errorConstructor = Local<Function>::Cast(globalObj->Get(Nan::New("Error").ToLocalChecked()));
npm ERR!       |                                                                                                             ^
npm ERR! In file included from /home/gautier/.cache/node-gyp/16.17.1/include/node/node.h:73,
npm ERR!                  from /home/gautier/.cache/node-gyp/16.17.1/include/node/node_buffer.h:25,
npm ERR!                  from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4007:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
npm ERR!  4007 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR!       |                                           ^~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4007:43: note:   candidate expects 2 arguments, 1 provided
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4010:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
npm ERR!  4010 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR!       |                                           ^~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4010:43: note:   candidate expects 2 arguments, 1 provided
npm ERR! ../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local<v8::Value> [1])’
npm ERR!   275 |   Local<Value> error = errorConstructor->NewInstance(1, constructorArgs);
npm ERR!       |                                                                        ^
npm ERR! In file included from /home/gautier/.cache/node-gyp/16.17.1/include/node/node.h:73,
npm ERR!                  from /home/gautier/.cache/node-gyp/16.17.1/include/node/node_buffer.h:25,
npm ERR!                  from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4759:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const’
npm ERR!  4759 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
npm ERR!       |                                            ^~~~~~~~~~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4759:44: note:   candidate expects 3 arguments, 2 provided
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4762:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const’
npm ERR!  4762 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
npm ERR!       |                                            ^~~~~~~~~~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:4762:44: note:   candidate expects 1 argument, 2 provided
npm ERR! ../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   282 |   Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
npm ERR!       |                                                                                             ^
npm ERR! In file included from ../src/BluetoothHciSocket.cpp:8:
npm ERR! ../../nan/nan.h:1051:46: note: declared here
npm ERR!  1051 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindRaw(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../src/BluetoothHciSocket.cpp:395:34: error: no matching function for call to ‘v8::Value::IntegerValue()’
npm ERR!   395 |       devId = arg0->IntegerValue();
npm ERR!       |                                  ^
npm ERR! In file included from /home/gautier/.cache/node-gyp/16.17.1/include/node/node.h:73,
npm ERR!                  from /home/gautier/.cache/node-gyp/16.17.1/include/node/node_buffer.h:25,
npm ERR!                  from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:3101:40: note: candidate: ‘v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const’
npm ERR!  3101 |   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR!       |                                        ^~~~~~~~~~~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:3101:40: note:   candidate expects 1 argument, 0 provided
npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindUser(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../src/BluetoothHciSocket.cpp:417:34: error: no matching function for call to ‘v8::Value::IntegerValue()’
npm ERR!   417 |       devId = arg0->IntegerValue();
npm ERR!       |                                  ^
npm ERR! In file included from /home/gautier/.cache/node-gyp/16.17.1/include/node/node.h:73,
npm ERR!                  from /home/gautier/.cache/node-gyp/16.17.1/include/node/node_buffer.h:25,
npm ERR!                  from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:3101:40: note: candidate: ‘v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const’
npm ERR!  3101 |   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR!       |                                        ^~~~~~~~~~~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/v8.h:3101:40: note:   candidate expects 1 argument, 0 provided
npm ERR! In file included from /home/gautier/.cache/node-gyp/16.17.1/include/node/node_buffer.h:25,
npm ERR!                  from ../src/BluetoothHciSocket.cpp:7:
npm ERR! ../src/BluetoothHciSocket.cpp: At global scope:
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/node.h:859:7: 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]
npm ERR!   859 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/gautier/.cache/node-gyp/16.17.1/include/node/node.h:893:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!   893 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/BluetoothHciSocket.cpp:499:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!   499 | NODE_MODULE(binding, BluetoothHciSocket::Init);
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [binding.target.mk:113 : Release/obj.target/binding/src/BluetoothHciSocket.o] Erreur 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.10.0-17-amd64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/gautier/Documents/Projects/temp-monitor/node_modules/bluetooth-hci-socket
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

Any help would be most appreciated. 🙂

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

1 participant