laverdet / isolated-vm

Secure & isolated JS environments for nodejs
ISC License
2.19k stars 154 forks source link

Compile errors with node 22 on archlinux #470

Closed augjoh closed 6 months ago

augjoh commented 6 months ago

When trying to install isolated-vm on archlinx, I'm getting the following compile error:

$ npm install --cache $CI_PROJECT_DIR/.npm --prefer-offline --no-audit --omit=dev --no-fund
npm error code 1
npm error path /builds/platynum/certification-authority/flows/node_modules/isolated-vm
npm error command failed
npm error command sh -c prebuild-install || (node-gyp rebuild --release -j max && node-gyp clean)
npm error make: Entering directory '/builds/platynum/certification-authority/flows/node_modules/isolated-vm/build'
npm error   CXX(target) Release/obj.target/nortti/src/external_copy/serializer_nortti.o
npm error   CXX(target) Release/obj.target/nortti/src/isolate/allocator_nortti.o
npm error make: Leaving directory '/builds/platynum/certification-authority/flows/node_modules/isolated-vm/build'
npm error prebuild-install warn install No prebuilt binaries found (target=22.0.0 runtime=node arch=x64 libc= platform=linux)
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.1.0
npm error gyp info using node@22.0.0 | linux | x64
npm error gyp info find Python using Python version 3.12.3 found at "/usr/sbin/python3"
npm error gyp http GET https://nodejs.org/download/release/v22.0.0/node-v22.0.0-headers.tar.gz
npm error gyp http 200 https://nodejs.org/download/release/v22.0.0/node-v22.0.0-headers.tar.gz
npm error gyp http GET https://nodejs.org/download/release/v22.0.0/SHASUMS256.txt
npm error gyp http 200 https://nodejs.org/download/release/v22.0.0/SHASUMS256.txt
npm error gyp info spawn /usr/sbin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/builds/platynum/certification-authority/flows/node_modules/isolated-vm/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.cache/node-gyp/22.0.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/22.0.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/22.0.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/builds/platynum/certification-authority/flows/node_modules/isolated-vm',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 2 ]
npm error In file included from /root/.cache/node-gyp/22.0.0/include/node/v8-array-buffer.h:12,
npm error                  from /root/.cache/node-gyp/22.0.0/include/node/v8.h:24,
npm error                  from ../src/external_copy/external_copy.h:2,
npm error                  from ../src/external_copy/serializer.h:2,
npm error                  from ../src/external_copy/serializer_nortti.cc:1:
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-local-handle.h:401:30: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]
npm error   401 |   V8_INLINE explicit Local<T>(const LocalBase<T>& other)
npm error       |                              ^
npm error In file included from /root/.cache/node-gyp/22.0.0/include/node/v8-array-buffer.h:12,
npm error                  from /root/.cache/node-gyp/22.0.0/include/node/v8.h:24,
npm error                  from ../src/isolate/allocator.h:2,
npm error                  from ../src/isolate/allocator_nortti.cc:1:
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-local-handle.h:401:30: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]
npm error   401 |   V8_INLINE explicit Local<T>(const LocalBase<T>& other)
npm error       |                              ^
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-local-handle.h:401:30: note: remove the ‘< >’
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-local-handle.h:401:30: note: remove the ‘< >’
npm error In file included from ../src/isolate/generic/array.h:2,
npm error                  from ../src/external_copy/external_copy.h:9:
npm error ../src/isolate/generic/error.h:84:85: error: conversion from ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’ in a converted constant expression
npm error    84 | using RuntimeGenericError = detail::RuntimeErrorWithConstructor<v8::Exception::Error>;
npm error       |                                                                                     ^
npm error ../src/isolate/generic/error.h:84:85: error: could not convert ‘v8::Exception::Error’ from ‘v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’
npm error    84 | using RuntimeGenericError = detail::RuntimeErrorWithConstructor<v8::Exception::Error>;
npm error       |                                                                                     ^
npm error       |                                                                                     |
npm error       |                                                                                     v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)
npm error ../src/isolate/generic/error.h:85:86: error: conversion from ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’ in a converted constant expression
npm error    85 | using RuntimeTypeError = detail::RuntimeErrorWithConstructor<v8::Exception::TypeError>;
npm error       |                                                                                      ^
npm error ../src/isolate/generic/error.h:85:86: error: could not convert ‘v8::Exception::TypeError’ from ‘v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’
npm error    85 | using RuntimeTypeError = detail::RuntimeErrorWithConstructor<v8::Exception::TypeError>;
npm error       |                                                                                      ^
npm error       |                                                                                      |
npm error       |                                                                                      v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)
npm error ../src/isolate/generic/error.h:86:88: error: conversion from ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’ in a converted constant expression
npm error    86 | using RuntimeRangeError = detail::RuntimeErrorWithConstructor<v8::Exception::RangeError>;
npm error       |                                                                                        ^
npm error ../src/isolate/generic/error.h:86:88: error: could not convert ‘v8::Exception::RangeError’ from ‘v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’
npm error    86 | using RuntimeRangeError = detail::RuntimeErrorWithConstructor<v8::Exception::RangeError>;
npm error       |                                                                                        ^
npm error       |                                                                                        |
npm error       |                                                                                        v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)
npm error In file included from ../src/isolate/strings.h:2,
npm error                  from ../src/isolate/environment.h:13,
npm error                  from ../src/isolate/allocator_nortti.cc:2:
npm error ../src/isolate/generic/error.h:84:85: error: conversion from ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’ in a converted constant expression
npm error    84 | using RuntimeGenericError = detail::RuntimeErrorWithConstructor<v8::Exception::Error>;
npm error       |                                                                                     ^
npm error ../src/isolate/generic/error.h:84:85: error: could not convert ‘v8::Exception::Error’ from ‘v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’
npm error    84 | using RuntimeGenericError = detail::RuntimeErrorWithConstructor<v8::Exception::Error>;
npm error       |                                                                                     ^
npm error       |                                                                                     |
npm error       |                                                                                     v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)
npm error ../src/isolate/generic/error.h:85:86: error: conversion from ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’ in a converted constant expression
npm error    85 | using RuntimeTypeError = detail::RuntimeErrorWithConstructor<v8::Exception::TypeError>;
npm error       |                                                                                      ^
npm error ../src/isolate/generic/error.h:85:86: error: could not convert ‘v8::Exception::TypeError’ from ‘v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’
npm error    85 | using RuntimeTypeError = detail::RuntimeErrorWithConstructor<v8::Exception::TypeError>;
npm error       |                                                                                      ^
npm error       |                                                                                      |
npm error       |                                                                                      v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)
npm error ../src/isolate/generic/error.h:86:88: error: conversion from ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’ in a converted constant expression
npm error    86 | using RuntimeRangeError = detail::RuntimeErrorWithConstructor<v8::Exception::RangeError>;
npm error       |                                                                                        ^
npm error ../src/isolate/generic/error.h:86:88: error: could not convert ‘v8::Exception::RangeError’ from ‘v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)’ to ‘v8::Local<v8::Value> (*)(v8::Local<v8::String>)’
npm error    86 | using RuntimeRangeError = detail::RuntimeErrorWithConstructor<v8::Exception::RangeError>;
npm error       |                                                                                        ^
npm error       |                                                                                        |
npm error       |                                                                                        v8::Local<v8::Value>(v8::Local<v8::String>, v8::Local<v8::Value>)
npm error ../src/external_copy/serializer.h: In member function ‘auto ivm::BaseSerializer::Deserialize(Fn)’:
npm error ../src/external_copy/serializer.h:101:47: error: there are no arguments to ‘RuntimeRangeError’ that depend on a template parameter, so a declaration of ‘RuntimeRangeError’ must be available [-fpermissive]
npm error   101 |                                         throw RuntimeRangeError("Array buffer allocation failed");
npm error       |                                               ^~~~~~~~~~~~~~~~~
npm error ../src/external_copy/serializer.h:101:47: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
npm error In file included from ../src/external_copy/serializer_nortti.cc:2:
npm error ../src/isolate/functor_runners.h: In function ‘void ivm::FunctorRunners::RunCatchExternal(v8::Local<v8::Context>, F1, F2)’:
npm error ../src/isolate/functor_runners.h:42:32: error: ISO C++ forbids declaration of ‘RuntimeTypeError’ with no type [-fpermissive]
npm error    42 |                 } catch (const RuntimeTypeError& cc_error) {
npm error       |                                ^~~~~~~~~~~~~~~~
npm error ../src/isolate/functor_runners.h:42:48: error: expected ‘)’ before ‘&’ token
npm error    42 |                 } catch (const RuntimeTypeError& cc_error) {
npm error       |                         ~                      ^
npm error       |                                                )
npm error ../src/isolate/functor_runners.h:42:48: error: expected ‘{’ before ‘&’ token
npm error ../src/isolate/functor_runners.h:42:50: error: ‘cc_error’ was not declared in this scope
npm error    42 |                 } catch (const RuntimeTypeError& cc_error) {
npm error       |                                                  ^~~~~~~~
npm error ../src/isolate/functor_runners.h:45:19: error: expected primary-expression before ‘catch’
npm error    45 |                 } catch (const RuntimeRangeError& cc_error) {
npm error       |                   ^~~~~
npm error ../src/isolate/functor_runners.h:47:19: error: expected primary-expression before ‘catch’
npm error    47 |                 } catch (const RuntimeGenericError& cc_error) {
npm error       |                   ^~~~~
npm error ../src/isolate/functor_runners.h:49:19: error: expected primary-expression before ‘catch’
npm error    49 |                 } catch (const detail::RuntimeErrorWithMessage& cc_error) {
npm error       |                   ^~~~~
npm error ../src/isolate/functor_runners.h:51:19: error: expected primary-expression before ‘catch’
npm error    51 |                 } catch (const RuntimeError& cc_error) {
npm error       |                   ^~~~~
npm error In file included from ../src/isolate/generic/callbacks.h:4,
npm error                  from ../src/isolate/class_handle.h:6,
npm error                  from ../src/module/transferable.h:2,
npm error                  from ../src/external_copy/serializer_nortti.cc:3:
npm error ../src/isolate/generic/extract_params.h: In member function ‘void ivm::detail::ParamExtractor<Offset, Args>::CheckLength(std::tuple<_Args1 ...>*)’:
npm error ../src/isolate/generic/extract_params.h:97:39: error: ‘RuntimeTypeError’ was not declared in this scope; did you mean ‘RuntimeError’?
npm error    97 |                                 throw RuntimeTypeError{CalleeName()+ " requires at least "+ std::to_string(adjusted)+ (adjusted == 1 ? " parameter" : " parameters")};
npm error       |                                       ^~~~~~~~~~~~~~~~
npm error       |                                       RuntimeError
npm error ../src/isolate/generic/extract_params.h: In member function ‘void ivm::detail::ParamExtractor<Offset, Args>::Caught(const ivm::ParamIncorrect&)’:
npm error ../src/isolate/generic/extract_params.h:111:39: error: ‘RuntimeTypeError’ was not declared in this scope; did you mean ‘RuntimeError’?
npm error   111 |                                 throw RuntimeTypeError{CalleeName()+ " requires `this` to be "+ ex.type};
npm error       |                                       ^~~~~~~~~~~~~~~~
npm error       |                                       RuntimeError
npm error ../src/isolate/generic/extract_params.h:113:39: error: ‘RuntimeTypeError’ was not declared in this scope; did you mean ‘RuntimeError’?
npm error   113 |                                 throw RuntimeTypeError{CalleeName()+ " requires parameter "+ std::to_string(ii + 1)+ " to be "+ ex.type};
npm error       |                                       ^~~~~~~~~~~~~~~~
npm error       |                                       RuntimeError
npm error In file included from ../src/isolate/class_handle.h:9:
npm error ../src/isolate/generic/read_option.h: In function ‘auto ivm::detail::ReadOptionImpl(v8::MaybeLocal<v8::Object>, Property&&, Default)’:
npm error ../src/isolate/generic/read_option.h:26:23: error: ‘RuntimeTypeError’ was not declared in this scope; did you mean ‘RuntimeError’?
npm error    26 |                 throw RuntimeTypeError{
npm error       |                       ^~~~~~~~~~~~~~~~
npm error       |                       RuntimeError
npm error ../src/isolate/generic/read_option.h:30:23: error: there are no arguments to ‘RuntimeTypeError’ that depend on a template parameter, so a declaration of ‘RuntimeTypeError’ must be available [-fpermissive]
npm error    30 |                 throw RuntimeTypeError(
npm error       |                       ^~~~~~~~~~~~~~~~
npm error ../src/isolate/class_handle.h: In member function ‘void ivm::ClassHandle::TemplateDefinition::Add(const char*, ivm::detail::MemberAccessorHolder, Args ...)’:
npm error ../src/isolate/class_handle.h:94:51: error: no matching function for call to ‘v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>&, void (* const&)(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&), void (* const&)(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&), v8::Local<v8::String>&, v8::AccessControl, v8::PropertyAttribute)’
npm error    94 |                                 proto->SetAccessor(name_handle, impl.getter.callback, impl.setter.callback, name_handle, v8::AccessControl::DEFAULT, v8::PropertyAttribute::None);
npm error       |                                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm error In file included from /root/.cache/node-gyp/22.0.0/include/node/v8-function.h:15,
npm error                  from /root/.cache/node-gyp/22.0.0/include/node/v8.h:33:
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-template.h:1055:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm error  1055 |   void SetAccessor(
npm error       |        ^~~~~~~~~~~
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-template.h:1058:61: note:   no known conversion for argument 5 from ‘v8::AccessControl’ to ‘v8::PropertyAttribute’
npm error  1058 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
npm error       |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-template.h:1049:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, v8::AccessorGetterCallback, v8::AccessorSetterCallback, v8::Local<v8::Value>, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm error  1049 |   void SetAccessor(
npm error       |        ^~~~~~~~~~~
npm error /root/.cache/node-gyp/22.0.0/include/node/v8-template.h:1052:61: note:   no known conversion for argument 5 from ‘v8::AccessControl’ to ‘v8::PropertyAttribute’
npm error  1052 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
npm error       |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
npm error ../src/isolate/class_handle.h: In static member function ‘static void ivm::ClassHandle::PrivateConstructor(const v8::FunctionCallbackInfo<v8::Value>&)’:
npm error ../src/isolate/class_handle.h:152:31: error: ‘RuntimeTypeError’ was not declared in this scope; did you mean ‘RuntimeError’?
npm error   152 |                         throw RuntimeTypeError(detail::CalleeName(info)+ " constructor is private");
npm error       |                               ^~~~~~~~~~~~~~~~
npm error       |                               RuntimeError
npm error ../src/isolate/class
npm error ../src/isolate/class_handle.h:324:39: error: there are no arguments to ‘RuntimeTypeError’ that depend on a template parameter, so a declaration of ‘RuntimeTypeError’ must be available [-fpermissive]
npm error   324 |                                 throw RuntimeTypeError(detail::CalleeName(info)+ " must be called with `new`");
npm error       |                                       ^~~~~~~~~~~~~~~~
npm error make: *** [nortti.target.mk:152: Release/obj.target/nortti/src/isolate/allocator_nortti.o] Error 1
npm error make: *** Waiting for unfinished jobs....
npm error make: *** [nortti.target.mk:152: Release/obj.target/nortti/src/external_copy/serializer_nortti.o] Error 1
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Linux 5.15.154+
npm error gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" "-j" "max"
npm error gyp ERR! cwd /builds/platynum/certification-authority/flows/node_modules/isolated-vm
npm error gyp ERR! node -v v22.0.0
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok

Is it save to set --permissive as a workaround?

augjoh commented 6 months ago

Duplicate of #468

elijahr2411 commented 6 months ago

For anyone else on Arch reading this who doesn't want to downgrade the system version of Node (a bad idea in general on a rolling release system), check out Node Version Manager