Skip to content

Failed to install/compile native extensions on Ruby 3.3.0 #22

Description

@TiuTalk

I'm using Arch Linux, with Linux Kernel 6.8.9, and I'm having issues while trying to install this gem using:

gem install cbor -v '0.5.9.6'

Below, are the relevant versions and the install log, please let me know if there is anything else I can provide to help investigate this issue 🙏🏼

Versions

➜ uname -a
Linux gemini 6.8.9-arch1-2 #1 SMP PREEMPT_DYNAMIC Tue, 07 May 2024 21:35:54 +0000 x86_64 GNU/Linux

➜ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]

➜ bundle -v
Bundler version 2.4.6

➜ gem -v
3.5.10

➜ asdf --version
v0.14.0

Install log

current directory: /home/TiuTalk/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/cbor-0.5.9.6/ext/cbor
/home/TiuTalk/.asdf/installs/ruby/3.3.0/bin/ruby extconf.rb
checking for ruby/st.h... yes
checking for st.h... no
checking for rb_str_replace() in ruby.h... yes
checking for rb_big_new() in ruby.h... yes
checking for rb_intern_str() in ruby.h... yes
checking for rb_sym2str() in ruby.h... yes
checking for rb_str_intern() in ruby.h... yes
checking for rb_integer_unpack() in ruby.h... yes
creating Makefile

current directory: /home/TiuTalk/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/cbor-0.5.9.6/ext/cbor
make DESTDIR\= sitearchdir\=./.gem.20240513-243498-4of9ji sitelibdir\=./.gem.20240513-243498-4of9ji clean

current directory: /home/TiuTalk/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/cbor-0.5.9.6/ext/cbor
make DESTDIR\= sitearchdir\=./.gem.20240513-243498-4of9ji sitelibdir\=./.gem.20240513-243498-4of9ji
compiling buffer.c
In file included from sysdep.h:30,
                 from buffer.h:33,
                 from buffer.c:28:
buffer.c: In function ‘CBOR_buffer_static_init’:
renamer.h:32:36: warning: old-style function definition [-Wold-style-definition]
   32 | #define msgpack_buffer_static_init CBOR_buffer_static_init
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~
buffer.c:46:6: note: in expansion of macro ‘msgpack_buffer_static_init’
   46 | void msgpack_buffer_static_init()
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
buffer.c: In function ‘CBOR_buffer_static_destroy’:
renamer.h:31:39: warning: old-style function definition [-Wold-style-definition]
   31 | #define msgpack_buffer_static_destroy CBOR_buffer_static_destroy
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
buffer.c:63:6: note: in expansion of macro ‘msgpack_buffer_static_destroy’
   63 | void msgpack_buffer_static_destroy()
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
compiling buffer_class.c
buffer_class.c: In function ‘read_until_eof’:
buffer_class.c:270:17: error: passing argument 3 of ‘rb_rescue2’ from incompatible pointer type [-Wincompatible-pointer-types]
  270 |                 read_until_eof_error, (VALUE)(void*) args,
      |                 ^~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 VALUE (*)(VALUE) {aka long unsigned int (*)(long unsigned int)}
In file included from /home/TiuTalk/.asdf/installs/ruby/3.3.0/include/ruby-3.3.0/ruby/ruby.h:41,
                 from /home/TiuTalk/.asdf/installs/ruby/3.3.0/include/ruby-3.3.0/ruby.h:38,
                 from compat.h:30,
                 from buffer_class.c:28:
/home/TiuTalk/.asdf/installs/ruby/3.3.0/include/ruby-3.3.0/ruby/internal/iterator.h:388:63: note: expected ‘VALUE (*)(VALUE,  VALUE)’ {aka ‘long unsigned int (*)(long unsigned int,  long unsigned int)’} but argument is of type ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’}
  388 | VALUE rb_rescue2(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*r_proc)(VALUE, VALUE), VALUE data2, ...);
      |                                                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
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:248: buffer_class.o] Error 1

make failed, exit code 2

Activity

  1. cabo commented on May 13, 2024

    @cabo
    Owner

    Hi TiuTalk,

    I gather you are using a recent version of a compiler that has become more heavy-handed about K&R style function definitions and other warnings. This of course can be fixed by making the source code more conservative about causing these warnings.
    It will take me a few days to prepare a PR for this. (If you want to leap ahead, that would be welcome.)

  2. TiuTalk commented on May 13, 2024

    @TiuTalk
    Author

    Hey @cabo thanks for the quick reply! Sadly, I'm not well versed in C to be able to open this PR :(

    Maybe I should try downgrading my compiler?

  3. TiuTalk commented on May 13, 2024

    @TiuTalk
    Author

    Updating the gem from 0.5.9.6 to 0.5.9.8 solved the issue! 🚀

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