Skip to content

Conversation

@mcheshkov
Copy link
Contributor

Check List

  • Tests have been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Description of Changes Made (if issue reference is not provided)

Current cpu-features depends on old version of nan, which fails to compile for Node.js 20.17 with errors like this:

In file included from ../node_modules/nan/nan.h:178,
                 from ../src/binding.cc:3:
../node_modules/nan/nan_callbacks.h:55:23: error: 'AccessorSignature' is not a member of 'v8'
   55 | typedef v8::Local<v8::AccessorSignature> Sig;
      |                       ^~~~~~~~~~~~~~~~~
../node_modules/nan/nan_callbacks.h:55:40: error: template argument 1 is invalid
   55 | typedef v8::Local<v8::AccessorSignature> Sig;
      |                                        ^
../node_modules/nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
../node_modules/nan/nan.h:2544:19: 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&)'
 2544 |   tpl->SetAccessor(
      |   ~~~~~~~~~~~~~~~~^
 2545 |       name
      |       ~~~~
 2546 |     , getter_
      |     ~~~~~~~~~
 2547 |     , setter_
      |     ~~~~~~~~~
 2548 |     , obj
      |     ~~~~~
 2549 |     , settings
      |     ~~~~~~~~~~
 2550 |     , attribute
      |     ~~~~~~~~~~~
 2551 |     , signature);
      |     ~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/20.17.0/include/node/v8-function.h:15,
                 from /root/.cache/node-gyp/20.17.0/include/node/v8.h:33,
                 from /root/.cache/node-gyp/20.17.0/include/node/node.h:73,
                 from ../src/binding.cc:1:
/root/.cache/node-gyp/20.17.0/include/node/v8-template.h:809: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)'
  809 |   void SetAccessor(
      |        ^~~~~~~~~~~
/root/.cache/node-gyp/20.17.0/include/node/v8-template.h:814:22: note:   no known conversion for argument 7 from 'Nan::imp::Sig' {aka 'int'} to 'v8::SideEffectType'
  814 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
      |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/20.17.0/include/node/v8-template.h:816: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)'
  816 |   void SetAccessor(
      |        ^~~~~~~~~~~
/root/.cache/node-gyp/20.17.0/include/node/v8-template.h:821:22: note:   no known conversion for argument 7 from 'Nan::imp::Sig' {aka 'int'} to 'v8::SideEffectType'
  821 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
      |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/binding.cc: At global scope:
/root/.cache/node-gyp/20.17.0/include/node/node.h:1232: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]
 1232 |       (node::addon_register_func) (regfunc),                          \\\n      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/20.17.0/include/node/node.h:1266:3: note: in expansion of macro 'NODE_MODULE_X'
 1266 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/binding.cc:152:1: note: in expansion of macro 'NODE_MODULE'
  152 | NODE_MODULE(cpufeatures, init)
      | ^~~~~~~~~~~
make: *** [cpufeatures.target.mk:119: Release/obj.target/cpufeatures/src/binding.o] Error 1

@mcheshkov mcheshkov marked this pull request as ready for review February 13, 2025 13:27
Copy link
Member

@KSDaemon KSDaemon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@mcheshkov mcheshkov merged commit e849a34 into master Feb 13, 2025
35 checks passed
@mcheshkov mcheshkov deleted the bump-cpu-features branch February 13, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants