"undefining the allocator of T_DATA" warnings with Ruby 3.2 and 3.3
Running the ruby-libvirt examples with Ruby 3.2.3 or 3.3.0 generates these errors (3.2.0 should too but I didn't test that):
conn.rb:8: warning: undefining the allocator of T_DATA class Libvirt::Connect
domain_create.rb:63: warning: undefining the allocator of T_DATA class Libvirt::Connect
domain_create.rb:69: warning: undefining the allocator of T_DATA class Libvirt::Domain
event_test.rb:436: warning: undefining the allocator of T_DATA class Libvirt::Connect
interface.rb:17: warning: undefining the allocator of T_DATA class Libvirt::Connect
interface.rb:23:in `define_interface_xml': Call to virInterfaceDefineXML failed: internal error: could not get interface XML description: internal error - The interface name 'ruby-libvirt-tester' exceeds the maximum allowed length: 15 (Libvirt::DefinitionError)
from interface.rb:23:in `<main>'
After shortening the name to 15 chars since Linux interface names must be IFNAMSIZ
(15 + terminating 0) characters or less:
interface.rb:17: warning: undefining the allocator of T_DATA class Libvirt::Connect
interface.rb:23: warning: undefining the allocator of T_DATA class Libvirt::Interface
network.rb:24: warning: undefining the allocator of T_DATA class Libvirt::Connect
network.rb:30: warning: undefining the allocator of T_DATA class Libvirt::Network
nodedevices.rb:7: warning: undefining the allocator of T_DATA class Libvirt::Connect
nodedevices.rb:15: warning: undefining the allocator of T_DATA class Libvirt::NodeDevice
node_info.rb:5: warning: undefining the allocator of T_DATA class Libvirt::Connect
nwfilter.rb:23: warning: undefining the allocator of T_DATA class Libvirt::Connect
nwfilter.rb:29: warning: undefining the allocator of T_DATA class Libvirt::NWFilter
open.rb:9: warning: undefining the allocator of T_DATA class Libvirt::Connect
secret.rb:22: warning: undefining the allocator of T_DATA class Libvirt::Connect
secret.rb:28: warning: undefining the allocator of T_DATA class Libvirt::Secret
storage.rb:37: warning: undefining the allocator of T_DATA class Libvirt::Connect
storage.rb:43: warning: undefining the allocator of T_DATA class Libvirt::StoragePool
storage.rb:75: warning: undefining the allocator of T_DATA class Libvirt::StorageVol
The warnings about undefining the allocator are due to a change made in Ruby 3.2.0. Please refer to:
- Help developers of C extensions meet requirements in "doc/extension.rdoc"
- Warn unless T_DATA object classes redefine or undefine the alloc function
- cext: ensure we undefine allocate for T_DATA classes (an example of how Nokogiri fixed the problem in their code)