Skip to content

chore: Update jaro_winkler dependency version

John McDonnell requested to merge jmd/update-jaro-winkler-gem into master

What does this MR do and why?

I ran into an issue an issue with the gem jaro_winkler 1.5.4 when running on ruby 3.2.3
See https://github.com/tonytonyjan/jaro_winkler/issues/51 which documents this as being something introduced in ruby 3.2.2

Let's bump this dependency to the latest version to work around this

Screenshots or screen recordings

bundle install failure log
Installing jaro_winkler 1.5.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler
/Users/john/.asdf/installs/ruby/3.2.3/bin/ruby extconf.rb
creating Makefile

current directory: /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler
make DESTDIR\= sitearchdir\=./.gem.20240402-82480-h1s44g sitelibdir\=./.gem.20240402-82480-h1s44g clean

current directory: /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler
make DESTDIR\= sitearchdir\=./.gem.20240402-82480-h1s44g sitelibdir\=./.gem.20240402-82480-h1s44g
compiling adj_matrix.c
compiling codepoints.c
compiling jaro.c
compiling jaro_winkler.c
jaro_winkler.c:19:3: error: incompatible function pointer types passing 'VALUE (size_t, VALUE *, VALUE)' (aka 'unsigned long (unsigned long, unsigned long *, unsigned long)')
to parameter of type 'VALUE (*)(int, union (unnamed union at /Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:271:1), VALUE)' (aka 'unsigned
long (*)(int, union (unnamed at /Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:271:1), unsigned long)')
[-Wincompatible-function-pointer-types]
  rb_define_singleton_method(rb_mJaroWinkler, "distance",
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:308:143: note: expanded from macro 'rb_define_singleton_method'
#define rb_define_singleton_method(obj, mid, func, arity)   RBIMPL_ANYARGS_DISPATCH_rb_define_singleton_method((arity), (func))((obj), (mid), (func), (arity))
                                                                                                                                              ^~~~~~
/Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:271:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_singleton_method, VALUE, const char *)
^
/Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m1(__VA_ARGS__, VALUE(*)(int, union { VALUE *x; const VALUE *y; } __attribute__((__transparent_union__)), VALUE), int); \
                                                                       ^
jaro_winkler.c:21:3: error: incompatible function pointer types passing 'VALUE (size_t, VALUE *, VALUE)' (aka 'unsigned long (unsigned long, unsigned long *, unsigned long)')
to parameter of type 'VALUE (*)(int, union (unnamed union at /Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:271:1), VALUE)' (aka 'unsigned
long (*)(int, union (unnamed at /Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:271:1), unsigned long)')
[-Wincompatible-function-pointer-types]
  rb_define_singleton_method(rb_mJaroWinkler, "jaro_distance", rb_jaro_distance,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:308:143: note: expanded from macro 'rb_define_singleton_method'
#define rb_define_singleton_method(obj, mid, func, arity)   RBIMPL_ANYARGS_DISPATCH_rb_define_singleton_method((arity), (func))((obj), (mid), (func), (arity))
                                                                                                                                              ^~~~~~
/Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:271:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_singleton_method, VALUE, const char *)
^
/Users/john/.asdf/installs/ruby/3.2.3/include/ruby-3.2.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _m1(__VA_ARGS__, VALUE(*)(int, union { VALUE *x; const VALUE *y; } __attribute__((__transparent_union__)), VALUE), int); \
                                                                       ^
2 errors generated.
make: *** [jaro_winkler.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/jaro_winkler-1.5.4 for inspection.
Results logged to /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/extensions/arm64-darwin-23/3.2.0/jaro_winkler-1.5.4/gem_make.out

  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:125:in `run'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:51:in `block in make'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in `each'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in `make'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:193:in `build_extension'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:227:in `block in build_extensions'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:224:in `each'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:224:in `build_extensions'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:852:in `build_extensions'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/source/rubygems.rb:200:in `install'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/installer/gem_installer.rb:54:in `install'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/installer/parallel_installer.rb:155:in `do_install'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/installer/parallel_installer.rb:146:in `block in worker_pool'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/worker.rb:62:in `apply_func'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/worker.rb:57:in `block in process_queue'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/worker.rb:54:in `loop'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/worker.rb:54:in `process_queue'
  /Users/john/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/bundler-2.4.5/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing jaro_winkler (1.5.4), and Bundler cannot continue.

In Gemfile:
  solargraph was resolved to 0.49.0, which depends on
    jaro_winkler

How to set up and validate locally

# verify running on ruby >3.2.2
➜ ruby -v
ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [arm64-darwin23]

# verify install works
➜ bundle install
...
...
Bundle complete! 14 Gemfile dependencies, 117 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by John McDonnell

Merge request reports