Skip to content

Commit

Permalink
Fix jaro_winkler compilation errors on MacOS
Browse files Browse the repository at this point in the history
The `jaro_winkler` gem is a dependency of `rubocop`.

Previously I was seeing compilation errors like the following when
running `bundle install` on recent versions of Ruby:

    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 ~/.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 ~/.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",
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~/.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))
                                                                                                                                                  ^~~~~~
    ~/.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 *)
    ^
    ~/.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); \
                                                                       ^
This seems to be the issue described in tonytonyjan/jaro_winkler#51
which was fixed in tonytonyjan/jaro_winkler#52 and which was released in
jaro_winkler v1.5.5 [1].

[1]: tonytonyjan/jaro_winkler#51 (comment)
  • Loading branch information
floehopper committed Jul 30, 2024
1 parent eb1b8ea commit 5c7d14c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if RUBY_VERSION >= '2.2.0'
gem 'minitest'
end
if RUBY_VERSION >= '2.2.0'
gem 'jaro_winkler', '>= 1.5.5'
gem 'rubocop', '<= 0.58.2'
end
if ENV['MOCHA_GENERATE_DOCS']
Expand Down

0 comments on commit 5c7d14c

Please sign in to comment.