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

Binaries for nodejs 19 #891

Closed
zdm opened this issue Oct 18, 2022 · 8 comments
Closed

Binaries for nodejs 19 #891

zdm opened this issue Oct 18, 2022 · 8 comments

Comments

@zdm
Copy link

zdm commented Oct 18, 2022

Unable to compile for nodejs 19:

prebuild info begin Prebuild version 11.0.4
prebuild info build Preparing to prebuild better-sqlite3@7.6.2 for node 19.0.0 on linux-x64 using node-gyp
gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v19.0.0/node-v19.0.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v19.0.0/node-v19.0.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v19.0.0/SHASUMS2[56](https://github.com/softvisio/sqlite/actions/runs/3275382262/jobs/5390155918#step:4:57).txt
gyp http 200 https://nodejs.org/download/release/v19.0.0/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/node_modules/prebuild/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/node_modules/prebuild/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/prebuild/node/19.0.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/tmp/prebuild/node/19.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/node_modules/prebuild/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/tmp/prebuild/node/19.0.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/build'
  TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
rm -f Release/obj.target/deps/sqlite3.a Release/obj.target/deps/sqlite3.a.ar-file-list; mkdir -p `dirname Release/obj.target/deps/sqlite3.a`
ar crs Release/obj.target/deps/sqlite3.a @Release/obj.target/deps/sqlite3.a.ar-file-list
  COPY Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ./src/better_sqlite3.lzz:11,
                 from ../src/better_sqlite3.cpp:4:
/tmp/prebuild/node/19.0.0/include/node/node.h:996:51: warning: cast between incompatible function types from ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>)’ to ‘node::addon_context_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)’} [-Wcast-function-type]
  996 |       (node::addon_context_register_func) (regfunc),                  \
      |                                                   ^
/tmp/prebuild/node/19.0.0/include/node/node.h:1014:3: note: in expansion of macro ‘NODE_MODULE_CONTEXT_AWARE_X’
 1014 |   NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/prebuild/node/19.0.0/include/node/node.h:1045:3: note: in expansion of macro ‘NODE_MODULE_CONTEXT_AWARE’
 1045 |   NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME,                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
./src/better_sqlite3.lzz:67:1: note: in expansion of macro ‘NODE_MODULE_INIT’
./src/util/macros.lzz: In function ‘void SetPrototypeGetter(v8::Isolate*, v8::Local<v8::External>, v8::Local<v8::FunctionTemplate>, const char*, v8::AccessorGetterCallback)’:
./src/util/macros.lzz:1[57](https://github.com/softvisio/sqlite/actions/runs/3275382262/jobs/5390155918#step:4:58):21: error: ‘v8::AccessorSignature’ has not been declared
./src/util/binder.lzz: In static member function ‘static bool Binder::IsPlainObject(v8::Isolate*, v8::Local<v8::Object>)’:
./src/util/binder.lzz:37:51: error: ‘class v8::Object’ has no member named ‘CreationContext’; did you mean ‘GetCreationContext’?
./src/util/data.lzz: In function ‘v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_stmt*, int, bool)’:
./src/util/data.lzz:73:92: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:73:197: note: here
./src/util/data.lzz: In function ‘v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_value*, bool)’:
./src/util/data.lzz:77:81: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:77:175: note: here
make: *** [better_sqlite3.target.mk:125: Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
rm ba23eeee118cd63e1[60](https://github.com/softvisio/sqlite/actions/runs/3275382262/jobs/5390155918#step:4:61)15df3[67](https://github.com/softvisio/sqlite/actions/runs/3275382262/jobs/5390155918#step:4:68)567cb043fed8[72](https://github.com/softvisio/sqlite/actions/runs/3275382262/jobs/5390155918#step:4:73).intermediate
make: Leaving directory '/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/build'
prebuild ERR! build error 
prebuild ERR! stack Error: `make` failed with exit code: 2
prebuild ERR! stack     at ChildProcess.onExit (/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/node_modules/prebuild/node_modules/node-gyp/lib/build.js:203:23)
prebuild ERR! stack     at ChildProcess.emit (node:events:513:28)
prebuild ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:2[93](https://github.com/softvisio/sqlite/actions/runs/3275382262/jobs/5390155918#step:4:94):12)
prebuild ERR! not ok 
prebuild ERR! build Error: `make` failed with exit code: 2
prebuild ERR! build     at ChildProcess.onExit (/home/runner/work/sqlite/sqlite/build/node_modules/better-sqlite3/node_modules/prebuild/node_modules/node-gyp/lib/build.js:203:23)
prebuild ERR! build     at ChildProcess.emit (node:events:513:28)
prebuild ERR! build     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
Error: Process completed with exit cod
@CharlesEkkel
Copy link

CharlesEkkel commented Oct 23, 2022

I can confirm this issue is replicable, I've been having it all afternoon. Below is the result of trying to add better-sqlite3 to an empty project generated using yarn init, with directory names redacted for privacy.

Edit: this issue can be circumvented by using an older version of node, as mentioned by @leafac in the linked issue above. But that's just circumventing the issue by using a pre-built binary.

>>> yarn add better-sqlite3
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error [PROJECT DIR]/node_modules/better-sqlite3: Command failed.
Exit code: 1
Command: prebuild-install || npm run build-release
Arguments: 
Directory: [PROJECT DIR]/node_modules/better-sqlite3
Output:
prebuild-install warn install No prebuilt binaries found (target=19.0.0 runtime=node arch=x64 libc= platform=linux)

> better-sqlite3@7.6.2 build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.0
gyp info using node@19.0.0 | linux | x64
gyp info find Python using Python version 3.10.8 found at "/sbin/python3"
gyp info spawn /sbin/python3
gyp info spawn args [
gyp info spawn args   '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '[PROJECT DIR]/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '[$HOME]/.cache/node-gyp/19.0.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=[$HOME]/.cache/node-gyp/19.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=[$HOME]/.cache/node-gyp/19.0.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=[PROJECT DIR]/node_modules/better-sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '[PROJECT DIR]/node_modules/better-sqlite3/build'
  TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
rm -f Release/obj.target/deps/sqlite3.a Release/obj.target/deps/sqlite3.a.ar-file-list; mkdir -p `dirname Release/obj.target/deps/sqlite3.a`
ar crs Release/obj.target/deps/sqlite3.a @Release/obj.target/deps/sqlite3.a.ar-file-list
  COPY Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ./src/better_sqlite3.lzz:11,
                 from ../src/better_sqlite3.cpp:4:
[$HOME]/.cache/node-gyp/19.0.0/include/node/node.h:996:7: warning: cast between incompatible function types from ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>)’ to ‘node::addon_context_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)’} [-Wcast-function-type]
  996 |       (node::addon_context_register_func) (regfunc),                  \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[$HOME]/.cache/node-gyp/19.0.0/include/node/node.h:1014:3: note: in expansion of macro ‘NODE_MODULE_CONTEXT_AWARE_X’
 1014 |   NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[$HOME]/.cache/node-gyp/19.0.0/include/node/node.h:1045:3: note: in expansion of macro ‘NODE_MODULE_CONTEXT_AWARE’
 1045 |   NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME,                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
./src/better_sqlite3.lzz:67:1: note: in expansion of macro ‘NODE_MODULE_INIT’
./src/util/macros.lzz: In function ‘void SetPrototypeGetter(v8::Isolate*, v8::Local<v8::External>, v8::Local<v8::FunctionTemplate>, const char*, v8::AccessorGetterCallback)’:
./src/util/macros.lzz:157:21: error: ‘v8::AccessorSignature’ has not been declared
./src/util/binder.lzz: In static member function ‘static bool Binder::IsPlainObject(v8::Isolate*, v8::Local<v8::Object>)’:
./src/util/binder.lzz:37:51: error: ‘class v8::Object’ has no member named ‘CreationContext’; did you mean ‘GetCreationContext’?
./src/util/data.lzz: In function ‘v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_stmt*, int, bool)’:
./src/util/data.lzz:73:92: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:73:197: note: here
./src/util/data.lzz: In function ‘v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_value*, bool)’:
./src/util/data.lzz:77:81: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:77:175: note: here
make: *** [better_sqlite3.target.mk:123: Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
make: Leaving directory '[PROJECT DIR]/node_modules/better-sqlite3/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 5.19.13-arch1-1
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd [PROJECT DIR]/node_modules/better-sqlite3
gyp ERR! node -v v19.0.0
gyp ERR! node-gyp -v v9.3.0
gyp ERR! not ok

@zdm
Copy link
Author

zdm commented Oct 23, 2022

Anybody can confirm it because nodejs api was changed and better-sqlite sources requires update.
We are waiting for @JoshuaWise .

@ceticamarco
Copy link

Same issue here. Works fine with latest LTS though.

@realamirhe
Copy link

realamirhe commented Nov 2, 2022

I faced the same issue with nodes 16.18and18.12`, but non of them worked.
It is not about the incompatibility with the node version I guess it might be related to the platform (system)

In my case, it is solved by following the actions

  1. Set the path of the python into my .zshrc file
  2. Update xcode-select (xcode-select --install) with the latest version (link)

@zdm
Copy link
Author

zdm commented Nov 4, 2022

@JoshuaWise Joshua, could you, please, take a look, if you are currently not busy? Something was changed in nodejs 19
and currently it is not compiling.

@irgaly
Copy link

irgaly commented Nov 7, 2022

It seems #870 will fix this issue.

#870 fixes error: ‘v8::AccessorSignature’ has not been declared and error: ‘class v8::Object’ has no member named ‘CreationContext’ errors.

@zdm
Copy link
Author

zdm commented Nov 10, 2022

Yes, PR #870 works for windows. linux and mac.

This was referenced Nov 13, 2022
@JoshuaWise
Copy link
Member

I'm releasing a major version with this fix tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants