Skip to content

taglib-ruby has warnings with Ruby 2.7.0 preview3 (waiting for swig release) #85

@jeremyevans

Description

@jeremyevans

I originally thought this could be a bug in Ruby itself, but according to my fellow ruby committer @shyouhei, this is due to problems in SWIG.

Here is an example error message when compiling (there are many like this):

taglib_base_wrap.cxx:2101:9: error: no matching function for call to 'rb_rescue'
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {                                                                                               
             ^~~~~~~~~                                       
                                                                                                                                                      
    /usr/local/include/ruby-2.7/ruby/ruby.h:1989:7: note: candidate function not viable: no known conversion from 'VALUE (VALUE *)' (aka 'unsigned long (unsigned long *)') to 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') for 1st argument                                                                                                                                                               
    VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);

Here are @shyouhei's comments:

Well, it seems the function called SWIG_ruby_failed is
prototyped as VALUE SWIG_ruby_failed(void) (source:
https://github.com/swig/swig/blob/master/Lib/ruby/rubyprimtypes.swg).

However the third argument of rb_rescue() is
VALUE (*)(VALUE, VALUE) (source: ruby.h).

So yes, the API change revealed an arity mismatch here. SWIG_ruby_failed
is getting more arguments than it expects, which is dangerous depending
on machine ABI. It has to be fixed. I believe it's SWIG, not the gem, wihch
has to handle this.

See https://bugs.ruby-lang.org/issues/16271 for my initial bug report to Ruby.

I don't think you can fix this without an update to SWIG, so you'll probably need to report this upstream to SWIG. After SWIG fixes it, I'm guessing you'll need to regenerate the cxx files from the i files with an updated SWIG version (I don't have any experience with SWIG).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions