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

Update the minimum version of sqlite3 #1667

Closed
wants to merge 1 commit into from

Conversation

smaboshe
Copy link
Contributor

@smaboshe smaboshe commented Jun 21, 2024

When running bundle install, are having an issue with sqlite3 version 1.4.2. It is not building on CI, M1 or Intel chips:

Building native extensions. This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    current directory: ~/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/sqlite3-1.4.2/ext/sqlite3
~/.asdf/installs/ruby/3.3.4/bin/ruby extconf.rb
checking for pkg-config for sqlite3... ["-I/opt/homebrew/opt/sqlite/include ", "-L/opt/homebrew/opt/sqlite/lib", "-lsqlite3"]
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... 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()... yes
checking for sqlite3_load_extension()... yes
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: ~/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/sqlite3-1.4.2/ext/sqlite3
make DESTDIR\= sitearchdir\=./.gem.20240719-68199-43z80t sitelibdir\=./.gem.20240719-68199-43z80t clean

current directory: ~/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/sqlite3-1.4.2/ext/sqlite3
make DESTDIR\= sitearchdir\=./.gem.20240719-68199-43z80t sitelibdir\=./.gem.20240719-68199-43z80t
compiling aggregator.c
compiling backup.c
compiling database.c
database.c:38:9: warning: unused variable 'flags' [-Wunused-variable]
  VALUE flags;
        ^
database.c:109:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  return INT2NUM((long)sqlite3_total_changes(ctx->db));
         ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:150: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:395:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  return INT2NUM((long)sqlite3_errcode(ctx->db));
         ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:726:57: error: incompatible function pointer types passing 'int (VALUE, int, char **, char **)' (aka 'int (unsigned long, int, char **, char **)') to parameter of type 'int (*)(void *, int, char **, char **)' [-Wincompatible-function-pointer-types]
    status = sqlite3_exec(ctx->db, StringValuePtr(sql), hash_callback_function, callback_ary, &errMsg);
                                                        ^~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/opt/sqlite/include/sqlite3.h:430:9: note: passing argument to parameter 'callback' here
  int (*callback)(void*,int,char**,char**),  /* Callback function */
        ^
database.c:726:81: error: incompatible integer to pointer conversion passing 'VALUE' (aka 'unsigned long') to parameter of type 'void *' [-Wint-conversion]
    status = sqlite3_exec(ctx->db, StringValuePtr(sql), hash_callback_function, callback_ary, &errMsg);
                                                                                ^~~~~~~~~~~~
/opt/homebrew/opt/sqlite/include/sqlite3.h:431:9: note: passing argument to parameter here
  void *,                                    /* 1st argument to callback */
        ^
database.c:728:57: error: incompatible function pointer types passing 'int (VALUE, int, char **, char **)' (aka 'int (unsigned long, int, char **, char **)') to parameter of type 'int (*)(void *, int, char **, char **)' [-Wincompatible-function-pointer-types]
    status = sqlite3_exec(ctx->db, StringValuePtr(sql), regular_callback_function, callback_ary, &errMsg);
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/opt/sqlite/include/sqlite3.h:430:9: note: passing argument to parameter 'callback' here
  int (*callback)(void*,int,char**,char**),  /* Callback function */
        ^
database.c:728:84: error: incompatible integer to pointer conversion passing 'VALUE' (aka 'unsigned long') to parameter of type 'void *' [-Wint-conversion]
    status = sqlite3_exec(ctx->db, StringValuePtr(sql), regular_callback_function, callback_ary, &errMsg);
                                                                                   ^~~~~~~~~~~~
/opt/homebrew/opt/sqlite/include/sqlite3.h:431:9: note: passing argument to parameter here
  void *,                                    /* 1st argument to callback */
        ^
4 warnings and 4 errors generated.
make: *** [database.o] Error 1

make failed, exit code 2

Gem files will remain installed in ~/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/sqlite3-1.4.2 for inspection.
Results logged to ~/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/extensions/arm64-darwin-23/3.3.0/sqlite3-1.4.2/gem_make.out

sqlite3 version 1.4.2 was released on 18 December 2019.

In this commit, we are bumping the Appraisal versions of sqlite3 to resolve this issue as it is currently blocking CI

Ref:

@smaboshe smaboshe force-pushed the set-minimum-sqlite-version branch from 644d119 to f00a7a3 Compare June 21, 2024 11:55
This project currently uses `sqlite3` version `1.4.2` which was released
on 18 December 2019. The latest version of `sqlite3` currently available
is `2.0.2` which was released on 23 May 2024.

This commit updates the minimum version of `sqlite3` to version `1.5.0`
that is readily able to compile on a M1 chip.
@sarahraqueld sarahraqueld marked this pull request as draft June 21, 2024 12:54
@smaboshe smaboshe force-pushed the set-minimum-sqlite-version branch from f00a7a3 to 1aca569 Compare June 21, 2024 12:58
@smaboshe smaboshe marked this pull request as ready for review July 19, 2024 09:47
Copy link
Member

@neilvcarvalho neilvcarvalho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this isn't needed. bundle install uses old a sqlite3 because that's what is defined on the lockfiles. Setting a minimum version on Gemfile forces bundle install to update the lockfiles, but the same could be accomplished by running:

bundle update sqlite3
bundle exec appraisal update sqlite3

This would only update the lockfiles. What do you think?

@sarahraqueld
Copy link
Contributor

Closing as this is not needed anymore after #1686

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

Successfully merging this pull request may close these issues.

3 participants