Skip to content

Update bigdecimal.c to fix issue with installation on macOS#307

Closed
mkyloa wants to merge 1 commit intoruby:masterfrom
mkyloa:patch-1
Closed

Update bigdecimal.c to fix issue with installation on macOS#307
mkyloa wants to merge 1 commit intoruby:masterfrom
mkyloa:patch-1

Conversation

@mkyloa
Copy link
Copy Markdown

@mkyloa mkyloa commented Dec 10, 2024

Update bigdecimal.c to fix issue with installation on macOS

Update bigdecimal.c to fix issue with installation on macOS
@olleolleolle
Copy link
Copy Markdown
Contributor

Perhaps this is trying to repair the same thing as #306?

@mrkn
Copy link
Copy Markdown
Member

mrkn commented Dec 25, 2024

@mkyloa Could you please describe what errors you encountered? I couldn't confirm there are any issues with installation on macOS.

@invalidusrname
Copy link
Copy Markdown

invalidusrname commented Feb 14, 2025

I'm noticing a similar error installing 2.X releases on OSX. I took this PR and built the gem locally. Installation seemed to work ok. Would appreciate a back port of this :-)

OSX Version

sw_vers
ProductName:		macOS
ProductVersion:		15.3
BuildVersion:		24D60

Gem Env:

RubyGems Environment:
  - RUBYGEMS VERSION: 3.6.3
  - RUBY VERSION: 3.4.1 (2024-12-25 patchlevel 0) [arm64-darwin24]
  - INSTALLATION DIRECTORY: /Users/matt/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0
  - USER INSTALLATION DIRECTORY: /Users/matt/.gem/ruby/3.4.0
  - CREDENTIALS FILE: /Users/matt/.local/share/gem/credentials
  - RUBY EXECUTABLE: /Users/matt/.local/share/mise/installs/ruby/3.4.1/bin/ruby
  - GIT EXECUTABLE: /opt/homebrew/bin/git
  - EXECUTABLE DIRECTORY: /Users/matt/.local/share/mise/installs/ruby/3.4.1/bin
  - SPEC CACHE DIRECTORY: /Users/matt/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/matt/.local/share/mise/installs/ruby/3.4.1/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - arm64-darwin-24
  - GEM PATHS:
     - /Users/matt/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0
     - /Users/matt/.gem/ruby/3.4.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :benchmark => false
     - :sources => ["http://rubygems.org"]
  - REMOTE SOURCES:
     - http://rubygems.org
  - SHELL PATH:
     - /Users/matt/.local/share/mise/installs/npm-prettier/3.3.3/bin
     - /Users/matt/.local/share/mise/installs/lua/5.1/bin
     - /Users/matt/.local/share/mise/installs/lua/5.1/luarocks/bin
     - /Users/matt/.local/share/mise/installs/node/20.11.1/bin
     - /Users/matt/.local/share/mise/installs/python/3.13.0/bin
     - /Users/matt/.local/share/mise/installs/ruby/3.4.1/bin
     - /Users/matt/.local/share/mise/installs/yarn/1.22.19/bin
     - /Users/matt/.local/bin
     - /opt/homebrew/opt/libpq/bin
     - /usr/local/heroku/bin
     - ./bin
     - /usr/local/bin
     - /usr/local/sbin
     - /opt/homebrew/bin
     - /opt/homebrew/sbin
     - /usr/local/bin
     - /System/Cryptexes/App/usr/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
     - /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
     - /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
     - /usr/local/MacGPG2/bin
     - /Applications/iTerm.app/Contents/Resources/utilities
     - /Users/matt/.orbstack/bin

Installation Log:

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

    current directory: /Users/matt/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bigdecimal-2.0.3/ext/bigdecimal
/Users/matt/.local/share/mise/installs/ruby/3.4.1/bin/ruby extconf.rb
checking RUBY_BIGDECIMAL_VERSION... 2.0.3
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 struct RComplex in ruby.h... no
checking for rb_complex_real() in ruby.h... yes
checking for rb_complex_imag() in ruby.h... yes
checking for rb_array_const_ptr() in ruby.h... yes
checking for rb_sym2str() in ruby.h... yes
checking for rb_opts_exception_p() in ruby.h... yes
checking for rb_category_warn() in ruby.h... yes
checking for RB_WARN_CATEGORY_DEPRECATED in ruby.h... yes
creating Makefile

current directory: /Users/matt/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bigdecimal-2.0.3/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20250214-12191-6acado sitelibdir\=./.gem.20250214-12191-6acado clean

current directory: /Users/matt/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bigdecimal-2.0.3/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20250214-12191-6acado sitelibdir\=./.gem.20250214-12191-6acado
compiling bigdecimal.c
bigdecimal.c:244:5: error: 'maybe_unused' attribute cannot be applied to types
  244 |     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/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:367:5: error: 'maybe_unused' attribute cannot be applied to types
  367 |     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/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:400:5: error: 'maybe_unused' attribute cannot be applied to types
  400 |     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/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:451:5: error: 'maybe_unused' attribute cannot be applied to types
  451 |     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/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:485:5: error: 'maybe_unused' attribute cannot be applied to types
  485 |     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/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:514:5: error: 'maybe_unused' attribute cannot be applied to types
  514 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:536:5: error: 'maybe_unused' attribute cannot be applied to types
  536 |     ENTER(2);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:856:5: error: 'maybe_unused' attribute cannot be applied to types
  856 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:903:5: error: 'maybe_unused' attribute cannot be applied to types
  903 |     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/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:996:5: error: 'maybe_unused' attribute cannot be applied to types
  996 |     ENTER(2);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1053:5: error: 'maybe_unused' attribute cannot be applied to types
 1053 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1111:5: error: 'maybe_unused' attribute cannot be applied to types
 1111 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1152:5: error: 'maybe_unused' attribute cannot be applied to types
 1152 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1348:5: error: 'maybe_unused' attribute cannot be applied to types
 1348 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1374:5: error: 'maybe_unused' attribute cannot be applied to types
 1374 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1402:5: error: 'maybe_unused' attribute cannot be applied to types
 1402 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1444:5: error: 'maybe_unused' attribute cannot be applied to types
 1444 |     ENTER(5);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1467:5: error: 'maybe_unused' attribute cannot be applied to types
 1467 |     ENTER(8);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
bigdecimal.c:1555:5: error: 'maybe_unused' attribute cannot be applied to types
 1555 |     ENTER(3);
      |     ^
bigdecimal.c:68:33: note: expanded from macro 'ENTER'
   68 | #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
      |                                 ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.0/ruby/backward/2/attributes.h:159:28: note: expanded from macro 'RB_UNUSED_VAR'
  159 | #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
      |                            ^
/Users/matt/.local/share/mise/installs/ruby/3.4.1/include/ruby-3.4.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]]
      |                                       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [bigdecimal.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/matt/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bigdecimal-2.0.3 for inspection.
Results logged to /Users/matt/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/extensions/arm64-darwin-24/3.4.0/bigdecimal-2.0.3/gem_make.out

Just updating the version to get a local build:

bigdecimal (patch-1) + $ gh pr checkout 307; git diff
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 7387e32..84f45e7 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -31,7 +31,7 @@
 #include "bits.h"
 #include "static_assert.h"

-#define BIGDECIMAL_VERSION "3.1.8"
+#define BIGDECIMAL_VERSION "2.0.4"

 /* #define ENABLE_NUMERIC_STRING */

Building and installing gem locally:

matt@M4-Mini:~/dev/play/bigdecimal (patch-1) + $ bundle exec rake install
bigdecimal 2.0.4 built to pkg/bigdecimal-2.0.4.gem.
bigdecimal (2.0.4) installed.
matt@M4-Mini:~/dev/play/bigdecimal (patch-1) + $ gem install pkg/bigdecimal-2.0.4.gem
Building native extensions. This could take a while...
Successfully installed bigdecimal-2.0.4
Parsing documentation for bigdecimal-2.0.4
Done installing documentation for bigdecimal after 0 seconds
1 gem installed
matt@M4-Mini:~/dev/play/bigdecimal (patch-1) + $ gem lista bigdecimal
ERROR:  While executing gem ... (Gem::UnknownCommandError)
    Unknown command lista
matt@M4-Mini:~/dev/play/bigdecimal (patch-1) + $ gem list bigdecimal

*** LOCAL GEMS ***

bigdecimal (3.1.9, 2.0.4)

Testing in irb:

matt@M4-Mini:~/dev/play/bigdecimal (patch-1) + $ irb
irb(main):001> gem "bigdecimal", "= 2.0.4"
=> true
irb(main):002> require 'bigdecimal'
=> true
irb(main):003> BigDecimal::VERSION
=> "2.0.4"

related: #304

@tompng
Copy link
Copy Markdown
Member

tompng commented Jul 28, 2025

Several lines around the changed line will be removed in #391.

- /* MACRO's to guard objects from GC by keeping them in stack */
- #ifdef RBIMPL_ATTR_MAYBE_UNUSED
- #define ENTER(n) RBIMPL_ATTR_MAYBE_UNUSED() volatile VALUE vStack[n];int iStack=0
- #else
- #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
- #endif
- #define PUSH(x)  (vStack[iStack++] = (VALUE)(x))
- #define GUARD_OBJ(p, y) ((p)=(y), PUSH((p).bigdecimal))

@tompng tompng closed this Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants