Update sqlite3 for Ruby 3
We can't run Ruby 3 locally, we get:
current directory: /Users/lipton/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/sqlite3-1.3.13/ext/sqlite3
/Users/lipton/.asdf/installs/ruby/3.0.3/bin/ruby -I /Users/lipton/.asdf/installs/ruby/3.0.3/lib/ruby/3.0.0 -r
./siteconf20220329-58278-46mf52.rb extconf.rb --with-sqlite3-lib\=/usr/lib
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for rb_integer_pack()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile
current directory: /Users/lipton/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/sqlite3-1.3.13/ext/sqlite3
make DESTDIR\= clean
current directory: /Users/lipton/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/sqlite3-1.3.13/ext/sqlite3
make DESTDIR\=
compiling backup.c
compiling database.c
database.c:60:3: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
rb_check_safe_obj(file);
^
database.c:60:3: note: did you mean 'rb_check_safe_str'?
/Users/lipton/.asdf/installs/ruby/3.0.3/include/ruby-3.0.0/ruby/internal/core/rstring.h:97:6: note: 'rb_check_safe_str'
declared here
void rb_check_safe_str(VALUE);
^
database.c:201:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return INT2NUM((long)sqlite3_total_changes(ctx->db));
~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:242:67: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
VALUE result = rb_funcall(handle, rb_intern("call"), 1, INT2NUM((long)count));
~~~~~~~ ^~~~~~~~~~~
database.c:552:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return INT2NUM((long)sqlite3_errcode(ctx->db));
~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 1 error generated.
make: *** [database.o] Error 1
make failed, exit code 2
Updating sqlite3 to the latest version 1.4.2
helps. We need to update it and merge it with the upstream.
It should only affect specs, so it should be self-checked by the CI.
Edited by Aleksei Lipniagov