fivdi / epoll

A low-level Node.js binding for the Linux epoll API
MIT License
84 stars 13 forks source link

nan no longer works due to ABI interface changes in node and electron #47

Closed sdetweil closed 2 years ago

sdetweil commented 2 years ago

see https://github.com/nodejs/nan/issues/922#issuecomment-974779085

using electron-rebuild with electron v20 export DEBUG=electron-rebuild

epoll rebuilds fine with just node v16.16.0

but cannot rebuild under electron


> Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall
> ../../node_modules/.bin/electron-rebuild -e ../../node_modules/electron

⠋ Searching dependency tree  electron-rebuild rebuilding with args: [Arguments] {
  '0': {
    buildPath: '/home/sam/MagicMirror/modules/MMM-PIR-Sensor',
    electronVersion: '20.1.1',
    arch: 'x64',
    extraModules: [],
    onlyModules: null,
    force: undefined,
    headerURL: undefined,
    types: [ 'prod', 'optional' ],
    mode: undefined,
    debug: undefined,
    prebuildTagPrefix: 'v',
    forceABI: undefined,
    useElectronClang: false,
    disablePreGypCopy: false,
    projectRootPath: '/home/sam/MagicMirror/modules/MMM-PIR-Sensor'
  }
} +0ms
  electron-rebuild rebuilding with args: /home/sam/MagicMirror/modules/MMM-PIR-Sensor 20.1.1 x64 Set(0) {} false https://www.electronjs.org/headers [ 'prod', 'optional' ] false +8ms
  electron-rebuild exploring /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/onoff +0ms
  electron-rebuild exploring /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll +3ms
  electron-rebuild exploring /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/lodash.debounce +1ms
  electron-rebuild exploring /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/bindings +6ms
  electron-rebuild exploring /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/nan +0ms
  electron-rebuild exploring /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/file-uri-to-path +2ms
  electron-rebuild identified prod deps: Set(0) {
  onoff: true,
  epoll: true,
  'lodash.debounce': true,
  bindings: true,
  nan: true,
  'file-uri-to-path': true
} +1ms
  electron-rebuild scanning: /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules +4ms
  electron-rebuild rebuilding epoll with args [
  'node',
  'node-gyp',
  'rebuild',
  '--runtime=electron',
  '--target=20.1.1',
  '--arch=x64',
  '--dist-url=https://www.electronjs.org/headers',
  '--build-from-source',
  '--verbose'
] +0ms
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
⠙ Building module: epoll, Completed: 0gyp verb command configure []
gyp verb download using dist-url https://www.electronjs.org/headers
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
⠹ Building module: epoll, Completed: 0gyp verb find Python - executable path is "/usr/bin/python3"
gyp verb find Python - executing "/usr/bin/python3" to get version
⠸ Building module: epoll, Completed: 0gyp verb find Python - version is "3.6.9"
gyp info find Python using Python version 3.6.9 found at "/usr/bin/python3"
gyp verb get node dir compiling against --target node version: 20.1.1
gyp verb command install [ '20.1.1' ]
gyp verb download using dist-url https://www.electronjs.org/headers
gyp verb install input version string "20.1.1"
gyp verb install installing version: 20.1.1
gyp verb install --ensure was passed, so won't reinstall if already installed
⠼ Building module: epoll, Completed: 0gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 20.1.1
gyp verb build dir attempting to create "build" dir: /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build
gyp verb build dir "build" dir needed to be created? Yes
gyp verb python symlink creating symlink to "/usr/bin/python3" at "/home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build/node_gyp_bins/python3"
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build/config.gypi
gyp verb config.gypi checking for gypi file: /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/config.gypi
gyp verb common.gypi checking for gypi file: /home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/sam/MagicMirror/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/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/sam/MagicMirror/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/sam/.electron-gyp/20.1.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/sam/.electron-gyp/20.1.1',
gyp info spawn args   '-Dnode_gyp_dir=/home/sam/MagicMirror/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/sam/.electron-gyp/20.1.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll',
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 args ]
⠇ Building module: epoll, Completed: 0gyp verb command build []
⠏ Building module: epoll, Completed: 0gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /home/sam/.electron-gyp/20.1.1
gyp verb `which` succeeded for `make` /usr/bin/make
gyp verb bin symlinks adding symlinks (such as Python), at "/home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build/node_gyp_bins", to PATH
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build'
  g++ -o Release/obj.target/epoll/src/epoll.o ../src/epoll.cc '-DNODE_GYP_MODULE_NAME=epoll' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DELECTRON_ENSURE_CONFIG_GYPI' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSING_ELECTRON_CONFIG_GYPI' '-DV8_COMPRESS_POINTERS' '-DV8_COMPRESS_POINTERS_IN_SHARED_CAGE' '-DV8_ENABLE_SANDBOX' '-DV8_SANDBOXED_POINTERS' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-DV8_REVERSE_JSARGS' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DBUILDING_NODE_EXTENSION' -I/home/sam/.electron-gyp/20.1.1/include/node -I/home/sam/.electron-gyp/20.1.1/src -I/home/sam/.electron-gyp/20.1.1/deps/openssl/config -I/home/sam/.electron-gyp/20.1.1/deps/openssl/openssl/include -I/home/sam/.electron-gyp/20.1.1/deps/uv/include -I/home/sam/.electron-gyp/20.1.1/deps/zlib -I/home/sam/.electron-gyp/20.1.1/deps/v8/include -I../../nan  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -Wno-deprecated-declarations -Wno-cast-function-type -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++14 -MMD -MF ./Release/.deps/Release/obj.target/epoll/src/epoll.o.d.raw  -std=c++17 -c
⠼ Building module: epoll, Completed: 0In file included from ../../nan/nan.h:180:0,
                 from ../src/epoll.cc:15:
../../nan/nan_callbacks.h:55:23: error: ‘AccessorSignature’ is not a member of ‘v8’
 typedef v8::Local<v8::AccessorSignature> Sig;
                       ^~~~~~~~~~~~~~~~~
../../nan/nan_callbacks.h:55:23: note: suggested alternative: ‘Signature’
 typedef v8::Local<v8::AccessorSignature> Sig;
                       ^~~~~~~~~~~~~~~~~
                       Signature
../../nan/nan_callbacks.h:55:40: error: template argument 1 is invalid
 typedef v8::Local<v8::AccessorSignature> Sig;
                                        ^
⠦ Building module: epoll, Completed: 0In file included from ../src/epoll.cc:15:0:
../../nan/nan.h: In function ‘void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)’:
../../nan/nan.h:2556:3: error: no matching function for call to ‘v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>&, void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&), void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&), v8::Local<v8::Object>&, v8::AccessControl&, v8::PropertyAttribute&, Nan::imp::Sig&)’
   );
   ^
In file included from /home/sam/.electron-gyp/20.1.1/include/node/v8-function.h:15:0,
                 from /home/sam/.electron-gyp/20.1.1/include/node/v8.h:33,
                 from ../src/epoll.cc:11:
/home/sam/.electron-gyp/20.1.1/include/node/v8-template.h:807:8: note: candidate: void v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, v8::AccessorGetterCallback, v8::AccessorSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)
   void SetAccessor(
        ^~~~~~~~~~~
/home/sam/.electron-gyp/20.1.1/include/node/v8-template.h:807:8: note:   no known conversion for argument 7 from ‘Nan::imp::Sig {aka int}’ to ‘v8::SideEffectType’
/home/sam/.electron-gyp/20.1.1/include/node/v8-template.h:814:8: note: candidate: void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)
   void SetAccessor(
        ^~~~~~~~~~~
/home/sam/.electron-gyp/20.1.1/include/node/v8-template.h:814:8: note:   no known conversion for argument 7 from ‘Nan::imp::Sig {aka int}’ to ‘v8::SideEffectType’
⠼ Building module: epoll, Completed: 0At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-cast-function-type’
epoll.target.mk:135: recipe for target 'Release/obj.target/epoll/src/epoll.o' failed
make: *** [Release/obj.target/epoll/src/epoll.o] Error 1
make: Leaving directory '/home/sam/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build'
✖ Rebuild Failed
fivdi commented 2 years ago

Duplicate of #42