noble / bleno

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals
MIT License
2.13k stars 450 forks source link

Electron Rebuild failed when installing Bleno #430

Open MeddahAbdellah opened 5 years ago

MeddahAbdellah commented 5 years ago

Hello , I am trying to make bleno run within an Electron App:

Node version : 8.15.0 NPM version : 6.4.1 Operating System : Raspbian (on Raspberry Pi3) Arch : armv71 bleno : 0.5.0 electron : 3.0.13

The module works when I try to use it without Electron , but when I do electron-rebuild I get the following error : An unhandled error occurred inside electron-rebuild gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@8.15.0 | linux | arm gyp info spawn /usr/bin/python2 gyp info spawn args [ '/home/pi/AlucentOs/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/home/pi/AlucentOs/node_modules/bluetooth-hci-socket/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/home/pi/AlucentOs/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.electron-gyp/iojs-3.0.13/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/root/.electron-gyp/iojs-3.0.13', gyp info spawn args '-Dnode_gyp_dir=/home/pi/AlucentOs/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/root/.electron-gyp/iojs-3.0.13/<(target_arch)/iojs.lib', gyp info spawn args '-Dmodule_root_dir=/home/pi/AlucentOs/node_modules/bluetooth-hci-socket', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] make: Entering directory '/home/pi/AlucentOs/node_modules/bluetooth-hci-socket/build' CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’: ../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); ^ In file included from ../src/BluetoothHciSocket.cpp:8:0: ../../nan/nan.h:980:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError()’: ../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local [1])’ Local error = errorConstructor->NewInstance(1, constructorArgs); ^ In file included from /root/.electron-gyp/iojs-3.0.13/src/node.h:54:0, from /root/.electron-gyp/iojs-3.0.13/src/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3853:44: note: candidate: v8::MaybeLocal v8::Function::NewInstance(v8::Local, int, v8::Local) const V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( ^~~ /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3853:44: note: candidate expects 3 arguments, 2 provided /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3856:44: note: candidate: v8::MaybeLocal v8::Function::NewInstance(v8::Local) const V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( ^~~ /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3856:44: note: candidate expects 1 argument, 2 provided ../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); ^ In file included from ../src/BluetoothHciSocket.cpp:8:0: ../../nan/nan.h:980:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ binding.target.mk:99: recipe for target 'Release/obj.target/binding/src/BluetoothHciSocket.o' failed make: Leaving directory '/home/pi/AlucentOs/node_modules/bluetooth-hci-socket/build' make: *** [Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/pi/AlucentOs/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Linux 4.14.79-v7+ gyp ERR! command "/usr/local/bin/node" "/home/pi/AlucentOs/node_modules/.bin/node-gyp" "rebuild" "--target=3.0.13" "--arch=arm" "--dist-url=https://atom.io/download/electron" "--build-from-source" gyp ERR! cwd /home/pi/AlucentOs/node_modules/bluetooth-hci-socket gyp ERR! node -v v8.15.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok

Failed with exit code: 1

Error: gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@8.15.0 | linux | arm gyp info spawn /usr/bin/python2 gyp info spawn args [ '/home/pi/AlucentOs/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/home/pi/AlucentOs/node_modules/bluetooth-hci-socket/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/home/pi/AlucentOs/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.electron-gyp/iojs-3.0.13/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/root/.electron-gyp/iojs-3.0.13', gyp info spawn args '-Dnode_gyp_dir=/home/pi/AlucentOs/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/root/.electron-gyp/iojs-3.0.13/<(target_arch)/iojs.lib', gyp info spawn args '-Dmodule_root_dir=/home/pi/AlucentOs/node_modules/bluetooth-hci-socket', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] make: Entering directory '/home/pi/AlucentOs/node_modules/bluetooth-hci-socket/build' CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’: ../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); ^ In file included from ../src/BluetoothHciSocket.cpp:8:0: ../../nan/nan.h:980:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError()’: ../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local [1])’ Local error = errorConstructor->NewInstance(1, constructorArgs); ^ In file included from /root/.electron-gyp/iojs-3.0.13/src/node.h:54:0, from /root/.electron-gyp/iojs-3.0.13/src/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3853:44: note: candidate: v8::MaybeLocal v8::Function::NewInstance(v8::Local, int, v8::Local) const V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( ^~~ /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3853:44: note: candidate expects 3 arguments, 2 provided /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3856:44: note: candidate: v8::MaybeLocal v8::Function::NewInstance(v8::Local) const V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( ^~~ /root/.electron-gyp/iojs-3.0.13/deps/v8/include/v8.h:3856:44: note: candidate expects 1 argument, 2 provided ../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); ^ In file included from ../src/BluetoothHciSocket.cpp:8:0: ../../nan/nan.h:980:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ binding.target.mk:99: recipe for target 'Release/obj.target/binding/src/BluetoothHciSocket.o' failed make: Leaving directory '/home/pi/AlucentOs/node_modules/bluetooth-hci-socket/build' make: *** [Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/pi/AlucentOs/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Linux 4.14.79-v7+ gyp ERR! command "/usr/local/bin/node" "/home/pi/AlucentOs/node_modules/.bin/node-gyp" "rebuild" "--target=3.0.13" "--arch=arm" "--dist-url=https://atom.io/download/electron" "--build-from-source" gyp ERR! cwd /home/pi/AlucentOs/node_modules/bluetooth-hci-socket gyp ERR! node -v v8.15.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok

Failed with exit code: 1 at SafeSubscriber._error (/home/pi/AlucentOs/node_modules/spawn-rx/lib/src/index.js:267:84) at SafeSubscriber.tryOrUnsub (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:207:16) at SafeSubscriber.error (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:158:26) at Subscriber._error (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:92:26) at Subscriber.error (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:72:18) at MapSubscriber.Subscriber._error (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:92:26) at MapSubscriber.Subscriber.error (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:72:18) at SafeSubscriber._next (/home/pi/AlucentOs/node_modules/spawn-rx/lib/src/index.js:242:65) at SafeSubscriber.tryOrUnsub (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:207:16) at SafeSubscriber.next (/home/pi/AlucentOs/node_modules/rxjs/internal/Subscriber.js:145:22)

Steps to Reproduce :

sudo npm cache clean -f \
sudo npm install -g n \
sudo n 8.15.0 \
sudo npm install --unsafe-perm=true \
sudo ./node_modules/.bin/electron-rebuild \

package.json :

{
  "name": "alucentos",
  "version": "1.0.0",
  "description": "AlucentX Operating System",
  "main": "index.js",
  "scripts": {
    "start": "electron ."
  },
    "author": "meddahAbdallah",
    "license": "ISC",
    "devDependencies": {
    "electron": "3.0.13",
    "electron-rebuild": "^1.8.4"
  },
    "dependencies": {
    "bleno": "^0.5.0",
    "node-bluetooth": "^1.2.5"
  }
}
bryanperris commented 5 years ago

You need the version of electron which uses node 8 as well, and that is 2.0.18.