mathiask88 / node-snap7

node.js wrapper for snap7
MIT License
163 stars 59 forks source link

Won't build with nodejs19 #88

Closed Grothesk242 closed 8 months ago

Grothesk242 commented 1 year ago

Module builds finde under nodejs 16 + 18, running nodejs 19 the build fails:

echad@chet:/opt/iobroker/node_modules/iobroker.s7 $ npm install --omit=dev
npm ERR! code 1
npm ERR! path /opt/iobroker/node_modules/iobroker.s7/node_modules/node-snap7
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! make: Entering directory '/opt/iobroker/node_modules/iobroker.s7/node_modules/node-snap7/build'
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/sys/snap_msgsock.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/sys/snap_sysutils.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/sys/snap_tcpsrvr.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/sys/snap_threads.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/core/s7_client.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/core/s7_isotcp.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/core/s7_partner.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/core/s7_peer.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/core/s7_server.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/core/s7_text.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/core/s7_micro_client.o
npm ERR!   CXX(target) Release/obj.target/snap7/deps/snap7/src/lib/snap7_libmain.o
npm ERR! rm -f Release/obj.target/snap7.a Release/obj.target/snap7.a.ar-file-list; mkdir -p `dirname Release/obj.target/snap7.a`
npm ERR! ar crs Release/obj.target/snap7.a @Release/obj.target/snap7.a.ar-file-list
npm ERR!   COPY Release/snap7.a
npm ERR!   CXX(target) Release/obj.target/node_snap7/src/node_snap7.o
npm ERR! make: Leaving directory '/opt/iobroker/node_modules/iobroker.s7/node_modules/node-snap7/build'
npm ERR! prebuild-install WARN install No prebuilt binaries found (target=19.3.0 runtime=node arch=arm64 libc= platform=linux)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@19.3.0 | linux | arm64
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   '/opt/iobroker/node_modules/iobroker.s7/node_modules/node-snap7/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/iobroker/.cache/node-gyp/19.3.0/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/iobroker/.cache/node-gyp/19.3.0',
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/iobroker/.cache/node-gyp/19.3.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/opt/iobroker/node_modules/iobroker.s7/node_modules/node-snap7',
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! ../deps/snap7/src/sys/snap_tcpsrvr.cpp: In member function ‘int TCustomMsgServer::StartTo(const char*, word)’:
npm ERR! ../deps/snap7/src/sys/snap_tcpsrvr.cpp:429:12: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 16 equals destination size [-Wstringop-truncation]
npm ERR!   429 |     strncpy(FLocalAddress, Address, 16);
npm ERR!       |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../deps/snap7/src/core/s7_isotcp.cpp: In member function ‘int TIsoTcpSocket::IsoConfirmConnection(u_char)’:
npm ERR! ../deps/snap7/src/core/s7_isotcp.cpp:163:10: warning: variable ‘TempRef’ set but not used [-Wunused-but-set-variable]
npm ERR!   163 |  u_short TempRef;
npm ERR!       |          ^~~~~~~
npm ERR! ../deps/snap7/src/core/s7_partner.cpp: In member function ‘int TConnectionServer::StartTo(const char*)’:
npm ERR! ../deps/snap7/src/core/s7_partner.cpp:252:12: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 16 equals destination size [-Wstringop-truncation]
npm ERR!   252 |     strncpy(FLocalAddress,Address,16);
npm ERR!       |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../deps/snap7/src/core/s7_server.cpp: In member function ‘byte TS7Worker::WriteArea(PReqFunWriteDataItem, PReqFunWriteItem, TEv&)’:
npm ERR! ../deps/snap7/src/core/s7_server.cpp:626:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
npm ERR!   626 |     if ((ReqItemPar->Area==S7AreaTM) ^ (ReqItemPar->TransportSize==S7WLTimer))
npm ERR!       |     ^~
npm ERR! ../deps/snap7/src/core/s7_server.cpp:629:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
npm ERR!   629 |  if ((ReqItemPar->Area==S7AreaCT) ^ (ReqItemPar->TransportSize==S7WLCounter))
npm ERR!       |  ^~
npm ERR! ../deps/snap7/src/core/s7_server.cpp: In member function ‘void TS7Worker::SZLSystemState()’:
npm ERR! ../deps/snap7/src/core/s7_server.cpp:1247:11: warning: ‘void* memcpy(void*, const void*, size_t)’ forming offset [4, 5] is out of the bounds [0, 4] of object ‘SZLNotAvail’ with type ‘byte [4]’ {aka ‘unsigned char [4]’} [-Warray-bounds]
npm ERR!  1247 |     memcpy(SZL.ResData,&SZLNotAvail,sizeof(SZLSysState));
npm ERR!       |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../deps/snap7/src/core/s7_server.cpp:27:
npm ERR! ../deps/snap7/src/core/s7_firmware.h:36:8: note: ‘SZLNotAvail’ declared here
npm ERR!    36 |   byte SZLNotAvail[4] = {
npm ERR!       |        ^~~~~~~~~~~
npm ERR! ../deps/snap7/src/core/s7_server.cpp: In member function ‘word TS7Worker::ReadArea(PResFunReadItem, PReqFunReadItem, int&, TEv&)’:
npm ERR! ../deps/snap7/src/core/s7_server.cpp:454:34: warning: ‘BitIndex’ may be used uninitialized in this function [-Wmaybe-uninitialized]
npm ERR!   454 |           if ((ByteVal & BitMask[BitIndex])!=0)
npm ERR!       |                                  ^~~~~~~~
npm ERR! ../deps/snap7/src/core/s7_server.cpp: In member function ‘byte TS7Worker::WriteArea(PReqFunWriteDataItem, PReqFunWriteItem, TEv&)’:
npm ERR! ../deps/snap7/src/core/s7_server.cpp:698:32: warning: ‘BitIndex’ may be used uninitialized in this function [-Wmaybe-uninitialized]
npm ERR!   698 |      *Target=*Target | BitMask[BitIndex];
npm ERR!       |                                ^~~~~~~~
npm ERR! ../deps/snap7/src/core/s7_text.cpp: In function ‘char* EvtSrvText(TSrvEvent&, char*, int)’:
npm ERR! ../deps/snap7/src/core/s7_text.cpp:782:5: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
npm ERR!   782 |     else
npm ERR!       |     ^~~~
npm ERR! ../deps/snap7/src/core/s7_text.cpp:785:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
npm ERR!   785 |  strncpy(Result, S, TextLen);
npm ERR!       |  ^~~~~~~
npm ERR! ../deps/snap7/src/core/s7_micro_client.cpp: In member function ‘void TSnap7MicroClient::SetConnectionParams(const char*, word, word)’:
npm ERR! ../deps/snap7/src/core/s7_micro_client.cpp:2675:13: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 16 equals destination size [-Wstringop-truncation]
npm ERR!  2675 |      strncpy(RemoteAddress, RemAddress, 16);
npm ERR!       |      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../deps/snap7/src/core/s7_micro_client.cpp: In member function ‘int TSnap7MicroClient::SetSessionPassword(char*)’:
npm ERR! ../deps/snap7/src/core/s7_micro_client.cpp:3306:16: warning: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
npm ERR!  3306 |         strncpy((char*)&opData,Password,L);
npm ERR!       |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../deps/snap7/src/core/s7_micro_client.cpp:3298:26: note: length computed here
npm ERR!  3298 |         size_t L = strlen(Password);
npm ERR!       |                    ~~~~~~^~~~~~~~~~
npm ERR! In file included from ../node_modules/nan/nan.h:176,
npm ERR!                  from ../src/node_snap7_client.h:11,
npm ERR!                  from ../src/node_snap7.cpp:6:
npm ERR! ../node_modules/nan/nan_callbacks.h:55:23: error: ‘AccessorSignature’ is not a member of ‘v8’
npm ERR!    55 | typedef v8::Local<v8::AccessorSignature> Sig;
npm ERR!       |                       ^~~~~~~~~~~~~~~~~
npm ERR! ../node_modules/nan/nan_callbacks.h:55:40: error: template argument 1 is invalid
npm ERR!    55 | typedef v8::Local<v8::AccessorSignature> Sig;
npm ERR!       |                                        ^
npm ERR! In file included from ../src/node_snap7_client.h:11,
npm ERR!                  from ../src/node_snap7.cpp:6:
npm ERR! ../node_modules/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)’:
npm ERR! ../node_modules/nan/nan.h:2549:16: 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&)’
npm ERR!  2549 |     , signature);
npm ERR!       |                ^
npm ERR! In file included from /home/iobroker/.cache/node-gyp/19.3.0/include/node/v8-function.h:15,
npm ERR!                  from /home/iobroker/.cache/node-gyp/19.3.0/include/node/v8.h:33,
npm ERR!                  from /home/iobroker/.cache/node-gyp/19.3.0/include/node/node.h:73,
npm ERR!                  from ../src/node_snap7_client.h:10,
npm ERR!                  from ../src/node_snap7.cpp:6:
npm ERR! /home/iobroker/.cache/node-gyp/19.3.0/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)’
npm ERR!   807 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/iobroker/.cache/node-gyp/19.3.0/include/node/v8-template.h:812:22: note:   no known conversion for argument 7 from ‘Nan::imp::Sig’ {aka ‘int’} to ‘v8::SideEffectType’
npm ERR!   812 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
npm ERR!       |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/iobroker/.cache/node-gyp/19.3.0/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)’
npm ERR!   814 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/iobroker/.cache/node-gyp/19.3.0/include/node/v8-template.h:819:22: note:   no known conversion for argument 7 from ‘Nan::imp::Sig’ {aka ‘int’} to ‘v8::SideEffectType’
npm ERR!   819 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
npm ERR!       |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../src/node_snap7_client.h:10,
npm ERR!                  from ../src/node_snap7.cpp:6:
npm ERR! ../src/node_snap7.cpp: At global scope:
npm ERR! /home/iobroker/.cache/node-gyp/19.3.0/include/node/node.h:993: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!   993 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/iobroker/.cache/node-gyp/19.3.0/include/node/node.h:1027:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!  1027 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/node_snap7.cpp:16:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!    16 | NODE_MODULE(node_snap7, InitAll)
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [node_snap7.target.mk:119: Release/obj.target/node_snap7/src/node_snap7.o] Error 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:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 5.15.76-v8+
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 /opt/iobroker/node_modules/iobroker.s7/node_modules/node-snap7
npm ERR! gyp ERR! node -v v19.3.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok
Apollon77 commented 8 months ago

see #93

mathiask88 commented 8 months ago

see #94