Skip to content

Ruby 3.1.6 compilation error on MacOS Sonoma 14 related to maybe_unused #304

Closed
@argent-codes

Description

@argent-codes

A similar issue was closed earlier in the year, so I apologize if this is considered a duplicate, but I am having the same issues compiling bigdecimal, only on a Ruby version that has not been EOL'd. I see that an openssl-related complication ruby-build issue has touched on similar things, but I am not sure whether / how solutions apply to me.

I am using a MacBook Pro M3, Sonoma Version 14.6.1 (23G93), with Ruby 3.1.6:

gem install bigdecimal -v '1.4.4'
Building native extensions. This could take a while...
ERROR:  Error installing bigdecimal:
	ERROR: Failed to build gem native extension.

    current directory: /Users/ekirilov/.gem/ruby/3.1.6/gems/bigdecimal-1.4.4/ext/bigdecimal
/Users/ekirilov/.rubies/ruby-3.1.6/bin/ruby -I /Users/ekirilov/.rubies/ruby-3.1.6/lib/ruby/3.1.0 extconf.rb
checking RUBY_BIGDECIMAL_VERSION... 1.4.4
checking for labs() in stdlib.h... yes
checking for llabs() in stdlib.h... yes
checking for finite() in math.h... no
checking for isfinite() in math.h... no
checking for struct RRational in ruby.h... no
checking for rb_rational_num() in ruby.h... yes
checking for rb_rational_den() in ruby.h... yes
checking for rb_array_const_ptr() in ruby.h... yes
checking for rb_sym2str() in ruby.h... yes
creating Makefile

current directory: /Users/ekirilov/.gem/ruby/3.1.6/gems/bigdecimal-1.4.4/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20240927-81327-8kcqw4 sitelibdir\=./.gem.20240927-81327-8kcqw4 clean

current directory: /Users/ekirilov/.gem/ruby/3.1.6/gems/bigdecimal-1.4.4/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20240927-81327-8kcqw4 sitelibdir\=./.gem.20240927-81327-8kcqw4
compiling bigdecimal.c
bigdecimal.c:220:5: error: 'maybe_unused' attribute cannot be applied to types
  220 |     ENTER(1);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/ekirilov/.rubies/ruby-3.1.6/include/ruby-3.1.0/ruby/backward/2/attributes.h:163:28: note: expanded from macro 'RB_UNUSED_VAR'
  163 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/ekirilov/.rubies/ruby-3.1.6/include/ruby-3.1.0/ruby/internal/attr/maybe_unused.h:31:39: note: expanded from macro 'RBIMPL_ATTR_MAYBE_UNUSED'
   31 | # define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
   

I feel like I must be doing something wrong, because I can see that this was patched in 3.1.0, but I don't know what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions