Skip to content

Gem won't compile in ruby 4.x #9

Description

@mvastola

So I'm getting this when I try to install the gem in ruby 4:

mvastola@vastdesk:~/tmp/test-repo$ gem install bitset
Building native extensions. This could take a while...
ERROR:  Error installing bitset:
ERROR: Failed to build gem native extension.

current directory: /usr/local/rvm/gems/ruby-4.0.3/gems/bitset-1.2.0/ext/bitset
/usr/local/rvm/rubies/ruby-4.0.3/bin/ruby extconf.rb
creating Makefile

current directory: /usr/local/rvm/gems/ruby-4.0.3/gems/bitset-1.2.0/ext/bitset
make -j33 DESTDIR\= sitearchdir\=./.gem.20260506-2887983-k7rqf0 sitelibdir\=./.gem.20260506-2887983-k7rqf0 clean

current directory: /usr/local/rvm/gems/ruby-4.0.3/gems/bitset-1.2.0/ext/bitset
make -j33 DESTDIR\= sitearchdir\=./.gem.20260506-2887983-k7rqf0 sitelibdir\=./.gem.20260506-2887983-k7rqf0
compiling bitset.c
bitset.c: In function ‘get_bitset’:
bitset.c:48:5: warning: ‘rb_data_object_get_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
48 |     Data_Get_Struct(obj, Bitset, bs);
|     ^~~~~~~~~~~~~~~
In file included from /usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core.h:27,
from /usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/ruby.h:29,
from /usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby.h:38,
from bitset.c:1:
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:328:1: note: declared here
328 | rb_data_object_get_warning(VALUE obj)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_alloc’:
bitset.c:54:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
54 |     obj = Data_Wrap_Struct(klass, 0, bitset_free, bitset_new());
|     ^~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_intersect’:
bitset.c:224:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
224 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_union’:
bitset.c:244:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
244 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_difference’:
bitset.c:264:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
264 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_xor’:
bitset.c:284:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
284 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_not’:
bitset.c:301:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
301 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_from_s’:
bitset.c:331:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
331 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_dup’:
bitset.c:406:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
406 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_values_at’:
bitset.c:520:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
520 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bitset.c: In function ‘rb_bitset_reverse’:
bitset.c:536:5: warning: ‘rb_data_object_wrap_warning’ is deprecated: by TypedData [-Wdeprecated-declarations]
536 |     return Data_Wrap_Struct(cBitset, 0, bitset_free, new_bs);
|     ^~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/core/rdata.h:296:1: note: declared here
296 | rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/ruby.h:27:
bitset.c: In function ‘Init_bitset’:
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/anyargs.h:291:135: error: passing argument 3 of ‘rb_define_method_00’ from incompatible pointer type [-Wincompatible-pointer-types]
291 | #define rb_define_method(klass, mid, func, arity)           RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func),(arity))
|                                                                                                                                       ^~~~~~
|                                                                                                                                       |
|                                                                                                                                       VALUE (*)(VALUE,  VALUE) {aka long unsigned int (*)(long unsigned int,  long unsigned int)}
bitset.c:605:5: note: in expansion of macro ‘rb_define_method’
605 |     rb_define_method(cBitset, "size", rb_bitset_size, 0);
|     ^~~~~~~~~~~~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/anyargs.h:280:21: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(VALUE,  VALUE)’ {aka ‘long unsigned int (*)(long unsigned int,  long unsigned int)’}
280 | RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
|                     ^~~~~~~~~~~~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/anyargs.h:258:41: note: in definition of macro ‘RBIMPL_ANYARGS_DECL’
258 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
|                                         ^~~
bitset.c:78:14: note: ‘rb_bitset_size’ declared here
78 | static VALUE rb_bitset_size(VALUE self, VALUE len) {
|              ^~~~~~~~~~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/anyargs.h:291:135: error: passing argument 3 of ‘rb_define_method_00’ from incompatible pointer type [-Wincompatible-pointer-types]
291 | #define rb_define_method(klass, mid, func, arity)           RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func),(arity))
|                                                                                                                                       ^~~~~~
|                                                                                                                                       |
|                                                                                                                                       VALUE (*)(VALUE,  VALUE) {aka long unsigned int (*)(long unsigned int,  long unsigned int)}
bitset.c:649:5: note: in expansion of macro ‘rb_define_method’
649 |     rb_define_method(cBitset, "reverse", rb_bitset_reverse, 0);
|     ^~~~~~~~~~~~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/anyargs.h:280:21: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(VALUE,  VALUE)’ {aka ‘long unsigned int (*)(long unsigned int,  long unsigned int)’}
280 | RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
|                     ^~~~~~~~~~~~~~~~
/usr/local/rvm/rubies/ruby-4.0.3/include/ruby-4.0.0/ruby/internal/anyargs.h:258:41: note: in definition of macro ‘RBIMPL_ANYARGS_DECL’
258 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
|                                         ^~~
bitset.c:524:14: note: ‘rb_bitset_reverse’ declared here
524 | static VALUE rb_bitset_reverse(VALUE self, VALUE index_array) {
|              ^~~~~~~~~~~~~~~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make: *** [Makefile:251: bitset.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/rvm/gems/ruby-4.0.3/gems/bitset-1.2.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-4.0.3/extensions/x86_64-linux/4.0.0/bitset-1.2.0/gem_make.out

This is on Ubuntu 25.10 with ruby 4.0.3. Happy to provide any more info that might help.

Here is the gem_make.out for fake of completeness, but it appears to be identical to the console output I pasted above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions