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

balena-cli 17.4.12 build issue with node 21 #2721

Open
chenrui333 opened this issue Jan 18, 2024 · 1 comment
Open

balena-cli 17.4.12 build issue with node 21 #2721

chenrui333 opened this issue Jan 18, 2024 · 1 comment

Comments

@chenrui333
Copy link

chenrui333 commented Jan 18, 2024

👋 while trying to build the latest release with node 21, I ran into some build issue as below:

npm ERR! gyp verb node dev dir /private/tmp/balena-cli-20240118-23020-spfffp/package/.brew_home/Library/Caches/node-gyp/21.6.0
npm ERR! gyp verb python /Applications/Xcode.app/Contents/Developer/usr/bin/python3
npm ERR! gyp verb `which` succeeded for `make` /opt/homebrew/Library/Homebrew/shims/mac/super/make
npm ERR! gyp verb bin symlinks created symlink to "/Applications/Xcode.app/Contents/Developer/usr/bin/python3" in "/opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/build/node_gyp_bins" and added to PATH
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! In file included from ../src/ffi.cc:5:
npm ERR! /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/get-uv-event-loop-napi-h/include/get-uv-event-loop-napi.h:26:30: error: incompatible function pointer types assigning to 'get_uv_event_loop_fn' (aka 'napi_status (*)(napi_env__ *, uv_loop_s **)') from 'napi_status (*)(node_api_nogc_env, struct uv_loop_s **)' (aka 'napi_status (*)(const napi_env__ *, uv_loop_s **)')
npm ERR!   napi_get_uv_event_loop__ = &napi_get_uv_event_loop;
npm ERR!                              ^~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../src/ffi.cc:3:
npm ERR! In file included from ../src/ffi.h:2:
npm ERR! In file included from /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi.h:2725:
npm ERR! /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
npm ERR!   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm ERR!            ^~~~~~~~~~~~~~~~~~
npm ERR! /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm ERR!     status = Napi::details::AttachData(env, *result, data);
npm ERR!                             ^
npm ERR! /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm ERR!   napi_status status = CreateFunction(env,
npm ERR!                        ^
npm ERR! ../src/ffi.cc:58:38: note: in instantiation of function template specialization 'Napi::Function::New<Napi::Value (*)(const Napi::CallbackInfo &)>' requested here
npm ERR!   target["ffi_prep_cif"] = Function::New(env, FFIPrepCif);
npm ERR!                                      ^
npm ERR! /private/tmp/balena-cli-20240118-23020-spfffp/package/.brew_home/Library/Caches/node-gyp/21.6.0/include/node/js_native_api.h:513:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_nogc_finalize' (aka 'void (*)(const napi_env__ *, void *, void *)') for 4th argument
npm ERR! napi_add_finalizer(napi_env env,
npm ERR! ^
npm ERR! In file included from ../src/ffi.cc:3:
npm ERR! In file included from ../src/ffi.h:2:
npm ERR! In file included from /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi.h:2725:
npm ERR! /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
npm ERR!   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm ERR!            ^~~~~~~~~~~~~~~~~~
npm ERR! /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<void (*)(const Napi::CallbackInfo &), void>>' requested here
npm ERR!     status = Napi::details::AttachData(env, *result, data);
npm ERR!                             ^
npm ERR! /opt/homebrew/Cellar/balena-cli/17.4.12/libexec/lib/node_modules/balena-cli/node_modules/ffi-napi/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<void (*)(const Napi::CallbackInfo &), void>>' requested here
npm ERR!   napi_status status = CreateFunction(env,
npm ERR!                        ^
npm ERR! ../src/ffi.cc:60:34: note: in instantiation of function template specialization 'Napi::Function::New<void (*)(const Napi::CallbackInfo &)>' requested here
npm ERR!   target["ffi_call"] = Function::New(env, FFICall);
npm ERR!                                  ^
npm ERR! /private/tmp/balena-cli-20240118-23020-spfffp/package/.brew_home/Library/Caches/node-gyp/21.6.0/include/node/js_native_api.h:513:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_nogc_finalize' (aka 'void (*)(const napi_env__ *, void *, void *)') for 4th argument
npm ERR! napi_add_finalizer(napi_env env,
npm ERR! ^
npm ERR! 3 errors generated.

For now, I just pin to use node@18, but maybe it is good to add node21 to the build matrix for the future?

relates to Homebrew/homebrew-core#160281

@otaviojacobi
Copy link
Contributor

otaviojacobi commented Apr 22, 2024

hey @chenrui333 Thanks for reporting. This was being caused by an issue on Node itself: nodejs/node#52229

We have fixed it in #2751 Would you consider pinning to use the latest supported version ^20.6.0 on homebew ?

As for node 21 we usually prefer to use only LTS node versions (node 20) as they will ship inside the package itself.

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