laverdet / node-fibers

Fiber/coroutine support for v8 and node.
MIT License
3.56k stars 224 forks source link

Fails to build on debian testing (required for rocket.chat 😕 ) #467

Open theoparis opened 1 year ago

theoparis commented 1 year ago
npm ERR! ../src/fibers.cc: In function 'void uni::MakeWeak(v8::Isolate*, v8::Persistent<T>&, P*)':
npm ERR! ../src/fibers.cc:27:79: error: 'kFinalizer' is not a member of 'v8::WeakCallbackType'
npm ERR!    27 |                 handle.SetWeak(val, WeakCallbackShim<F, P>, WeakCallbackType::kFinalizer);
npm ERR!       |                                                                               ^~~~~~~~~~
npm ERR! ../src/fibers.cc: In function 'void uni::SetAccessor(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, FunctionType (*)(v8::Local<v8::String>, const GetterCallbackInfo&), void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const SetterCallbackInfo&))':
npm ERR! ../src/fibers.cc:355:73: warning: cast between incompatible function types from 'uni::FunctionType (*)(v8::Local<v8::String>, const uni::GetterCallbackInfo&)' {aka 'void (*)(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)'} to 'v8::AccessorNameGetterCallback' {aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&)'} [-Wcast-function-type]
npm ERR!   355 |                 object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallback)setter).ToChecked();
npm ERR!       |                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../src/fibers.cc:355:109: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const uni::SetterCallbackInfo&)' {aka 'void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&)'} to 'v8::AccessorNameSetterCallback' {aka 'void (*)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&)'} [-Wcast-function-type]
npm ERR!   355 |                 object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallback)setter).ToChecked();
npm ERR!       |                                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../src/coroutine.h:1,
npm ERR!                  from ../src/fibers.cc:1:
npm ERR! ../src/fibers.cc: At global scope:
npm ERR! /root/.cache/node-gyp/20.4.0/include/node/node.h:1166:7: warning: cast between incompatible function types from '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!  1166 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /root/.cache/node-gyp/20.4.0/include/node/node.h:1200:3: note: in expansion of macro 'NODE_MODULE_X'
npm ERR!  1200 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/fibers.cc:930:1: note: in expansion of macro 'NODE_MODULE'
npm ERR!   930 | NODE_MODULE(fibers, init)
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [fibers.target.mk:122: Release/obj.target/fibers/src/fibers.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 (/tmp/bundle/programs/server/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:512:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
timofey3007 commented 1 year ago

Hi, have faced a similar issue when upgrading a node to version 20.5.1. According to the node documentation, kFinalizer is removed (in node v18 it was marked as deprecated). As I can see, kFinalizer is identical by description to the kParameter.

image

@laverdet Correct me if I'm wrong, but if kFinalizer is switched to kParameter, the build should work correctly.

Thanks.

laverdet commented 1 year ago

Hi please read the big notice on the front page.

theoparis commented 1 year ago

Should this issue be upstreamed to rocket.chat since it still uses this package?

laverdet commented 1 year ago

I'm surprised they are still using fibers. My guess is that if you open an issue over there they will tell you to use an older version of nodejs. Their README suggests 14.x