MadLittleMods / node-usb-detection

List USB devices in system and detect changes on them.
MIT License
371 stars 114 forks source link

Module rebuild fails with Electron 20 and onwards #172

Open testlogger opened 1 year ago

testlogger commented 1 year ago

When updating electron to version 20 and onwards, the rebuild fails with electron-rebuild. I get errors as follows.

⠴ Building module: usb-detection, Completed: 2  CXX(target) Release/obj.target/detection/src/detection.o
⠇ Building module: usb-detection, Completed: 2In file included from ../src/detection.cpp:1:
In file included from ../src/detection.h:13:
In file included from ../../nan/nan.h:180:
../../nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
typedef v8::Local<v8::AccessorSignature> Sig;
                  ~~~~^
In file included from ../src/detection.cpp:1:
In file included from ../src/detection.h:13:
../../nan/nan.h:2546:8: error: no matching member function for call to 'SetAccessor'
  tpl->SetAccessor(
  ~~~~~^~~~~~~~~~~
/Users/jussiluopajarvi/.electron-gyp/20.3.8/include/node/v8-template.h:814:8: note: candidate function not viable: no known conversion from 'imp::Sig' (aka 'int') to 'v8::SideEffectType' for 7th argument
  void SetAccessor(
       ^
/Users/jussiluopajarvi/.electron-gyp/20.3.8/include/node/v8-template.h:807:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'v8::AccessorGetterCallback' (aka 'void (*)(Local<v8::String>, const PropertyCallbackInfo<v8::Value> &)') for 2nd argument
  void SetAccessor(
       ^
In file included from ../src/detection.cpp:1:
In file included from ../src/detection.h:15:
../src/deviceList.h:7:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
typedef struct {
              ^
               ListResultItem_t
../src/deviceList.h:8:2: note: type is not C-compatible due to this member declaration
        public:
        ^~~~~~~
../src/deviceList.h:16:3: note: type is given name 'ListResultItem_t' for linkage purposes by this typedef declaration
} ListResultItem_t;
  ^
⠏ Building module: usb-detection, Completed: 21 warning and 2 errors generated.

Could this be related to the changes made in electron 20? See release notes at https://www.electronjs.org/blog/electron-20-0#breaking--api-changes

brad commented 1 year ago

Yep, it is fixed in nan 2.17.0. I no longer get that error after updating nan