Bug #16271
closedCannot build taglib-ruby gem on ruby-2.7.0-preview2
Description
Attempting to build the taglib-ruby gem on ruby-2.7.0-preview2 fails with error messages such as:
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);
I believe this is related to the CXX/ANYARGS changes made between ruby-2.7.0-preview1 and preview2. I was not aware these were expected to cause backwards compatibility issues, which is why I'm submitting the bug report here.
I believe taglib-ruby uses code generated via SWIG. I'm not sure if SWIG needs to be adjusted, or if the issue is related to the use of SWIG.
This may be a problem in the gem and not in our CXX handling. In that case, please let me know and I will post an issue in the gem's tracker.
Updated by shyouhei (Shyouhei Urabe) over 5 years ago
- Assignee changed from shyouhei (Shyouhei Urabe) to nobu (Nobuyoshi Nakada)
jeremyevans0 (Jeremy Evans) wrote:
Attempting to build the taglib-ruby gem on ruby-2.7.0-preview2 fails with error messages such as:
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);
I believe this is related to the CXX/ANYARGS changes made between ruby-2.7.0-preview1 and preview2. I was not aware these were expected to cause backwards compatibility issues, which is why I'm submitting the bug report here.
I believe taglib-ruby uses code generated via SWIG. I'm not sure if SWIG needs to be adjusted, or if the issue is related to the use of SWIG.
This may be a problem in the gem and not in our CXX handling. In that case, please let me know and I will post an issue in the gem's tracker.
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.
Updated by jeremyevans0 (Jeremy Evans) over 5 years ago
shyouhei (Shyouhei Urabe) wrote:
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.
@shyouhei (Shyouhei Urabe) , thank you very much for your quick analysis. I have posted this bug upstream (https://github.com/robinst/taglib-ruby/issues/85), though they probably need to wait for a SWIG update to fix it.
This can probably be closed unless @shyouhei (Shyouhei Urabe) or @nobu (Nobuyoshi Nakada) would like it to remain open.
Updated by nobu (Nobuyoshi Nakada) over 5 years ago
- Status changed from Open to Closed
Applied in changeset git|1d91feaf13e0ffe04b2dabc6e77e4101b6d0bb07.
Limit strict RUBY_METHOD_FUNC in C++
Limit strict function signature check with RUBY_METHOD_FUNC in C++
to bundled libraries only. [Bug #16271]