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

Make compatible with ruby v3+ #42

Open
Smolations opened this issue Nov 20, 2023 · 0 comments
Open

Make compatible with ruby v3+ #42

Smolations opened this issue Nov 20, 2023 · 0 comments

Comments

@Smolations
Copy link

The resolution of this issue allowed for a clean install/generation of cheatsets for ruby v2+. However, attempting to install the gem in ruby 3.2.2 resulted in some native extension build errors for nokogiri/nokogumbo and sqlite3 (and yes, I installed xcode CL tools). I haven't had time to mess with different versions yet, but most posts I find online that have similar build failures almost always include updating libraries in order to eliminate the errors.

$ gem install cheatset
Fetching sanitize-5.2.3.gem
Fetching sqlite3-1.3.13.gem
Fetching unindent-1.0.gem
Fetching haml-5.2.2.gem
Fetching nokogumbo-2.0.5.gem
Fetching redcarpet-3.6.0.gem
Fetching plist-3.7.0.gem
Fetching rouge-3.30.0.gem
Fetching cheatset-1.4.8.gem
Successfully installed unindent-1.0
Building native extensions. This could take a while...
ERROR:  Error installing cheatset:
	ERROR: Failed to build gem native extension.

    current directory: /Users/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sqlite3-1.3.13/ext/sqlite3
/Users/user/.rbenv/versions/3.2.2/bin/ruby extconf.rb
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/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sqlite3-1.3.13/ext/sqlite3
make DESTDIR\= sitearchdir\=./.gem.20231120-29588-5dciji sitelibdir\=./.gem.20231120-29588-5dciji clean

current directory: /Users/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sqlite3-1.3.13/ext/sqlite3
make DESTDIR\= sitearchdir\=./.gem.20231120-29588-5dciji sitelibdir\=./.gem.20231120-29588-5dciji
compiling backup.c
compiling database.c
database.c:60:3: error: call to undeclared function 'rb_check_safe_obj'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  rb_check_safe_obj(file);
  ^
database.c:60:3: note: did you mean 'rb_check_safe_str'?
/Users/user/.rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/core/rstring.h:383: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:233:3: warning: 'sqlite3_trace' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations]
  sqlite3_trace(ctx->db, NIL_P(block) ? NULL : tracefunc, (void *)self);
  ^~~~~~~~~~~~~
  sqlite3_trace_v2
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h:3222:36: note: 'sqlite3_trace' has been explicitly marked deprecated here
SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(
                                   ^
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:310:14: error: call to undeclared function 'rb_tainted_str_new2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      return rb_tainted_str_new2((const char *)sqlite3_value_text(val));
             ^
database.c:320:14: error: call to undeclared function 'rb_tainted_str_new'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      return rb_tainted_str_new((const char *)sqlite3_value_blob(val), len);
             ^
database.c:552:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  return INT2NUM((long)sqlite3_errcode(ctx->db));
         ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings and 3 errors generated.
make: *** [database.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /Users/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/extensions/arm64-darwin-22/3.2.0/sqlite3-1.3.13/gem_make.out
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

No branches or pull requests

1 participant