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

[Bug]: Cannot build [email protected] on macOS/Arch Linux #3946

Open
2 tasks done
akgerber opened this issue Dec 9, 2024 · 4 comments
Open
2 tasks done

[Bug]: Cannot build [email protected] on macOS/Arch Linux #3946

akgerber opened this issue Dec 9, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@akgerber
Copy link

akgerber commented Dec 9, 2024

Verified issue does not already exist?

  • I have searched and found no existing issue
  • I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file)

What happened?

I have been unable to build the better-sqlite3@npm:9.6.0 dependency as required by yarn install, I believe since I upgraded to MacOS Sequoia.

The initial problem (a missing climits file) I had was resolved by reinstalling developer tools, but this revealed a new problem:
yarn install log, truncated to the issue:

➤ YN0007: │ better-sqlite3@npm:9.6.0 must be built because it never has been before or the last one failed
➤ YN0009: │ better-sqlite3@npm:9.6.0 couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/1g/qjgtwn9967j9t7fltdr29vbr0000gp/T/xfs-c2f6d1ae/build.log)
➤ YN0000: └ Completed in 13s 163ms
➤ YN0000: · Failed with errors in 13s 543ms

The contents of /private/var/folders/1g/qjgtwn9967j9t7fltdr29vbr0000gp/T/xfs-c2f6d1ae/build.log

# This file contains the result of Yarn building a package (better-sqlite3@npm:9.6.0)
# Script name: install

prebuild-install warn install No prebuilt binaries found (target=23.3.0 runtime=node arch=arm64 libc= platform=darwin)
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.13.0 found at "/opt/homebrew/opt/[email protected]/bin/python3.13"

gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.13
gyp info spawn args [
gyp info spawn args '/Users/akgerber/Code/github/actual-server/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 '/Users/akgerber/Code/github/actual-server/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/akgerber/Code/github/actual-server/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/akgerber/Library/Caches/node-gyp/23.3.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=/Users/akgerber/Library/Caches/node-gyp/23.3.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/akgerber/Code/github/actual-server/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/akgerber/Library/Caches/node-gyp/23.3.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/akgerber/Code/github/actual-server/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' ]
  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
  LIBTOOL-STATIC Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/akgerber/Library/Caches/node-gyp/23.3.0/include/node/node.h:73:
In file included from /Users/akgerber/Library/Caches/node-gyp/23.3.0/include/node/v8.h:23:
In file included from /Users/akgerber/Library/Caches/node-gyp/23.3.0/include/node/cppgc/common.h:8:
/Users/akgerber/Library/Caches/node-gyp/23.3.0/include/node/v8config.h:13:2: error: "C++20 or later required."
   13 | #error "C++20 or later required."
      |  ^
In file included from ../src/better_sqlite3.cpp:4:
./src/util/macros.lzz:31:69: error: no template named 'CopyablePersistentTraits' in namespace 'v8'; did you mean 'NonCopyablePersistentTraits'?
   31 | template <class T> using CopyablePersistent = v8::Persistent<T, v8::CopyablePersistentTraits<T>>;
      |                                                                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                     NonCopyablePersistentTraits
/Users/akgerber/Library/Caches/node-gyp/23.3.0/include/node/v8-persistent-handle.h:223:7: note: 'NonCopyablePersistentTraits' declared here
  223 | class NonCopyablePersistentTraits {
      |       ^
In file included from ../src/better_sqlite3.cpp:4:
./src/util/macros.lzz:149:6: error: no type named 'AccessorGetterCallback' in namespace 'v8'; did you mean 'AccessorNameGetterCallback'?
  149 |         v8::AccessorGetterCallback func
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~
      |             AccessorNameGetterCallback
/Users/akgerber/Library/Caches/node-gyp/23.3.0/include/node/v8-object.h:155:7: note: 'AccessorNameGetterCallback' declared here
  155 | using AccessorNameGetterCallback =
      |       ^
./src/util/macros.lzz:158:6: error: no type named 'AccessorGetterCallback' in namespace 'v8'; did you mean 'AccessorNameGetterCallback'?
  158 |         v8::AccessorGetterCallback func
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~
      |             AccessorNameGetterCallback
/Users/akgerber/Library/Caches/node-gyp/23.3.0/include/node/v8-object.h:155:7: note: 'AccessorNameGetterCallback' declared here
  155 | using AccessorNameGetterCallback =
      |       ^
./src/util/macros.lzz:172:28: error: no member named 'SetAccessor' in 'v8::ObjectTemplate'
  172 |         recv->InstanceTemplate()->SetAccessor(
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^
./src/objects/database.lzz:17:17: error: no matching function for call to 'SetPrototypeGetter'
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^
./src/objects/database.lzz:17:17: error: no matching function for call to 'SetPrototypeGetter'
   17 |                 SetPrototypeGetter(isolate, data, t, "open", JS_open);
      |                 ^~~~~~~~~~~~~~~~~~
./src/util/macros.lzz:153:6: note: candidate function not viable: no known conversion from 'void (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &)' to 'v8::AccessorNameGetterCallback' (aka 'void (*)(Local<Name>, const PropertyCallbackInfo<Value> &)') for 5th argument
  153 | void SetPrototypeGetter(
      |      ^
  154 |         v8::Isolate* isolate,
  155 |         v8::Local<v8::External> data,
  156 |         v8::Local<v8::FunctionTemplate> recv,
  157 |         const char* name,
  158 |         v8::AccessorGetterCallback func
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/objects/database.lzz:18:17: error: no matching function for call to 'SetPrototypeGetter'
   18 |                 SetPrototypeGetter(isolate, data, t, "inTransaction", JS_inTransaction);
      |                 ^~~~~~~~~~~~~~~~~~
./src/util/macros.lzz:153:6: note: candidate function not viable: no known conversion from 'void (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &)' to 'v8::AccessorNameGetterCallback' (aka 'void (*)(Local<Name>, const PropertyCallbackInfo<Value> &)') for 5th argument
  153 | void SetPrototypeGetter(
      |      ^
  154 |         v8::Isolate* isolate,
  155 |         v8::Local<v8::External> data,
  156 |         v8::Local<v8::FunctionTemplate> recv,
  157 |         const char* name,
  158 |         v8::AccessorGetterCallback func
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
  180 |                 int status = sqlite3_db_config(db_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL);
      |                     ^
./src/objects/statement.lzz:16:17: error: no matching function for call to 'SetPrototypeGetter'
   16 |                 SetPrototypeGetter(isolate, data, t, "busy", JS_busy);
      |                 ^~~~~~~~~~~~~~~~~~
./src/util/macros.lzz:153:6: note: candidate function not viable: no known conversion from 'void (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &)' to 'v8::AccessorNameGetterCallback' (aka 'void (*)(Local<Name>, const PropertyCallbackInfo<Value> &)') for 5th argument
  153 | void SetPrototypeGetter(
      |      ^
  154 |         v8::Isolate* isolate,
  155 |         v8::Local<v8::External> data,
  156 |         v8::Local<v8::FunctionTemplate> recv,
  157 |         const char* name,
  158 |         v8::AccessorGetterCallback func
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/util/custom-table.lzz:45:9: warning: missing field 'xIntegrity' initializer [-Wmissing-field-initializers]
   45 |         };
      |         ^
./src/util/custom-table.lzz:72:9: warning: missing field 'xIntegrity' initializer [-Wmissing-field-initializers]
   72 |         };
      |         ^
3 warnings and 8 errors generated.
make: *** [Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/Users/akgerber/Code/github/actual-server/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Darwin 24.1.0
gyp ERR! command "/opt/homebrew/Cellar/node/23.3.0/bin/node" "/Users/akgerber/Code/github/actual-server/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/akgerber/Code/github/actual-server/node_modules/better-sqlite3
gyp ERR! node -v v23.3.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok

Some cursory Googling indicates that this may be related to recent distributions of C++ removing a long-deprecated function signature:
WiseLibs/better-sqlite3#1225

I was able to resolve the issue locally by bumping the dependency to latest version:

➜  actual-server git:(master) ✗ yarn add better-sqlite3
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + better-sqlite3@npm:11.7.0
➤ YN0085: │ - better-sqlite3@npm:9.6.0
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0002: │ actual-sync@workspace:. doesn't provide @babel/core (p89c81), requested by @babel/preset-typescript.
➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ A package was added to the project (+ 9.64 MiB).
➤ YN0000: └ Completed in 0s 490ms
➤ YN0000: ┌ Link step
➤ YN0007: │ better-sqlite3@npm:11.7.0 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 326ms
➤ YN0000: · Done with warnings in 1s 959ms
➜  actual-server git:(master) ✗ yarn install
➤ YN0000: · Yarn 4.3.1
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0002: │ actual-sync@workspace:. doesn't provide @babel/core (p89c81), requested by @babel/preset-typescript.
➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 249ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 0s 469ms

actual-server seems to run without issue on this newer version.

Where are you hosting Actual?

Locally via Yarn

What browsers are you seeing the problem on?

Other

Operating System

Mac OSX

@akgerber akgerber added the bug Something isn't working label Dec 9, 2024
@akgerber akgerber changed the title [Bug]: Cannot build better-sqlite@3:9.6.0 on macOS Sequoia [Bug]: Cannot build better-sqlite3@:9.6.0 on macOS Sequoia Dec 9, 2024
@akgerber akgerber changed the title [Bug]: Cannot build better-sqlite3@:9.6.0 on macOS Sequoia [Bug]: Cannot build [email protected] on macOS Sequoia Dec 9, 2024
@psybers
Copy link
Contributor

psybers commented Dec 13, 2024

I can confirm this build problem on Sonoma. I was trying to update my helper scripts and hit this same issue.

@benricok
Copy link

I can confirm the same problem building on arch linux

@akgerber akgerber changed the title [Bug]: Cannot build [email protected] on macOS Sequoia [Bug]: Cannot build [email protected] on macOS/Arch Linux Dec 15, 2024
@ru44
Copy link

ru44 commented Dec 20, 2024

I can confirm the same problem building on MacOS sequoia

@lelemm
Copy link
Contributor

lelemm commented Dec 20, 2024

try

yarn rebuild

I have had several problems with better-sqlite3 last month on another project that was solved by rebuilding it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants