taglib-ruby icon indicating copy to clipboard operation
taglib-ruby copied to clipboard

Ruby 3.2 warning "undefining the allocator of T_DATA class swig_runtime_data"

Open robinst opened this issue 3 years ago • 3 comments

Originally posted by @jeremyevans in https://github.com/robinst/taglib-ruby/issues/85#issuecomment-1087741124

While not related to the previous issue, I found that taglib 1.1.0 issues a warning when loaded on Ruby 3.2.0-preview1:

/usr/local/lib/ruby/gems/3.2/gems/taglib-ruby-1.1.0/lib/taglib_base.so: warning: undefining the allocator of T_DATA class swig_runtime_data

No runtime warning when using Ruby 3.0 or 3.1. Ruby 3.2.0 won't be released until near the end of the year, so hopefully this can be addressed before then. This also looks like an issue in swig and not specifically in taglib-ruby.

robinst avatar Apr 11 '22 00:04 robinst

Some reading:

  • Issue that introduced warning: https://bugs.ruby-lang.org/issues/18007
  • Extension dev docs: https://ruby-doc.org/core-3.1.1/doc/extension_rdoc.html#label-C+struct+to+Ruby+object
  • Example fix in mysql2: https://github.com/brianmario/mysql2/pull/1236

Seems like swig will need a fix after this line: https://github.com/swig/swig/blob/5a10e103992c49b8b402745b294fcdd4ca48e705/Lib/ruby/rubyrun.swg#L415

Will try to reproduce and then raise an issue and maybe PR in swig.

robinst avatar Apr 11 '22 01:04 robinst

Raised an issue and a PR in the swig repo for this: https://github.com/swig/swig/issues/2257

robinst avatar Apr 11 '22 01:04 robinst

The fix has been merged (that was quick!), so now we can wait for the next release of swig (4.1.0), regenerate wrappers and that should fix it.

robinst avatar Apr 12 '22 01:04 robinst

So I was poking at regenerating the wrappers and I quickly ran into the problem that the command encoder has been removed in 4.1.0! I tried poking at the two renames that use it (had never touched any SWIG code before so it took a while) and eventually discovered the problems of why we were using the command encoder in the first place (because we need to lowercase & also remove/add prefix/suffix).

I had the crazy idea of trying to add support to DOH in SWIG to support multiple encoders looking something like %(regex:/blah/bleh/|undercase)s, but I don't really know if that is feasible and I'm not very handy at C code.

Wondering if you had already looking into this and hit the same problems @robinst, and if you had any thoughts as to a better/easier fix. I'm very down to help implement whatever we come up with!

fusion2004 avatar Dec 12 '22 05:12 fusion2004

Hey @fusion2004! Hadn't looked into this yet, but your comment was very helpful. I've looked into it now and I've found a way to do what we need with regex. I'll push the change shortly (still need to clean it up a bit).

robinst avatar Dec 18 '22 12:12 robinst

Ok, PR is up, have a look please: https://github.com/robinst/taglib-ruby/pull/122

robinst avatar Dec 19 '22 12:12 robinst

Fix released in version 1.1.3

robinst avatar Dec 29 '22 10:12 robinst