Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not build with Node 22 on Apple Silicon #23

Closed
nazarhussain opened this issue May 3, 2024 · 3 comments
Closed

Can not build with Node 22 on Apple Silicon #23

nazarhussain opened this issue May 3, 2024 · 3 comments

Comments

@nazarhussain
Copy link

Can not build with Node 22 on Apple Silicon, while it was working fine with Node 20

gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@22.0.0 | darwin | arm64
..
..
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/hwcaps.o
  LIBTOOL-STATIC Release/cpu_features.a
  CXX(target) Release/obj.target/cpufeatures/src/binding.o
In file included from ../src/binding.cc:3:
../../nan/nan.h:2546:8: error: no matching member function for call to 'SetAccessor'
  tpl->SetAccessor(
  ~~~~~^~~~~~~~~~~
/Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/v8-template.h:1055:8: note: candidate function not viable: no known conversion from 'v8::AccessControl' to 'PropertyAttribute' for 5th argument
  void SetAccessor(
       ^
/Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/v8-template.h:1049:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
  void SetAccessor(
       ^
In file included from ../src/binding.cc:3:
../../nan/nan.h:2592:8: error: no matching member function for call to 'SetAccessor'
  tpl->SetAccessor(
  ~~~~~^~~~~~~~~~~
/Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/v8-template.h:1055:8: note: candidate function not viable: no known conversion from 'v8::AccessControl' to 'PropertyAttribute' for 5th argument
  void SetAccessor(
       ^
/Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/v8-template.h:1049:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
  void SetAccessor(
       ^
In file included from ../src/binding.cc:1:
In file included from /Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/node.h:73:
In file included from /Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/v8.h:24:
In file included from /Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/v8-array-buffer.h:12:
/Users/nazar/Library/Caches/node-gyp/22.0.0/include/node/v8-local-handle.h:269:5: error: static assertion failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value': type check
    static_assert(std::is_base_of<T, S>::value, \"type check\");
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../nan/nan_callbacks_12_inl.h:175:20: note: in instantiation of function template specialization 'v8::Local<v8::Value>::Local<v8::Data>' requested here
      cbinfo(info, obj->GetInternalField(kDataIndex));
                   ^
3 errors generated.
make: *** [Release/obj.target/cpufeatures/src/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/Users/nazar/Hub/project/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Darwin 23.4.0
gyp ERR! command \"/Users/nazar/.asdf/installs/nodejs/22.0.0/bin/node\" \"/Users/nazar/Hub/project/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /Users/nazar/Hub/project/node_modules/cpu-features
@nazarhussain
Copy link
Author

nazarhussain commented May 3, 2024

@mscdex Tried setting package via commit hash "git+ssh://git@github.com/mscdex/cpu-features.git#76160ec" and still get the same build error. Please re-open this issue.

@mscdex
Copy link
Owner

mscdex commented May 3, 2024

It's working in CI, so I'm not sure what to tell you.

Make sure there isn't something weird with your local setup. The errors were fixed with nan v2.19.0 and this package is now requiring v2.19.0 or newer.

@nazarhussain
Copy link
Author

@mscdex Thanks for pointing to the right direction. Adding a resolution for nan package "testcontainers/**/nan": "^2.19.0" fixed the issue for me.

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

No branches or pull requests

2 participants