Ruby 3.2 warning "undefining the allocator of T_DATA class swig_runtime_data"
robinst opened this issue · 7 comments
Originally posted by @jeremyevans in #85 (comment)
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.
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: brianmario/mysql2#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.
Raised an issue and a PR in the swig repo for this: swig/swig#2257
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.
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!
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).
Fix released in version 1.1.3