Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot install ruby gem bigdecimal, upgrading clang fixes it #2502

Open
jay-aye-see-kay opened this issue Feb 3, 2025 · 1 comment
Open
Labels
bug Something isn't working triage Issue needs triage

Comments

@jay-aye-see-kay
Copy link
Contributor

jay-aye-see-kay commented Feb 3, 2025

What happened?

The latest version of ruby cannot use bigdecimal a common transitive dependency. The previous minor version is fine, and I have a workaround adding clang to the project, but that feels like the wrong approach long term.

Steps to reproduce

# setup devbox
cd $(mktemp -d)
devbox init
devbox add [email protected] # current latest
devbox generate direnv

# setup ruby project
bundle init
bundle add bigdecimal # !!! FAILS HERE

# workaround #1 install a newer version of clang
clang --version # v11.1.0
devbox add clang
clang --version # v19.1.6
bundle install # SUCCESS: installs bigdecimal

# workaround #2 install an older version of ruby
devbox rm clang ruby
rm -rf $GEM_HOME
devbox add [email protected]
bundle install # SUCCESS: installs bigdecimal

# [optional] clean up
export OLD_DIR=$PWD
cd $HOME
rm -rf $OLD_DIR

Command

No response

devbox.json

{"packages": ["[email protected]"]}

Devbox version

0.13.7

Nix version

nix (Nix) 2.24.11

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

These are logs from bundle install as it's not a devbox command failing

Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching bigdecimal 3.1.9
Installing bigdecimal 3.1.9 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/private/var/folders/cp/kp1z7bk902qd09vnskdwr11r0000gp/T/tmp.Y8OnNpuhoj/.devbox/virtenv/ruby/gems/bigdecimal-3.1.9/ext/bigdecimal
/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/bin/ruby extconf.rb
checking for __builtin_clz()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include=${opt-dir}/include
        --without-opt-include
        --with-opt-lib=${opt-dir}/lib
        --without-opt-lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/bin/$(RUBY_BASE_NAME)
/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:528:in 'MakeMakefile#try_do': The compiler failed to generate an
executable file. (RuntimeError)
You have to install development tools first.

        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:655:in 'MakeMakefile#try_compile'
        from extconf.rb:6:in 'block in Object#have_builtin_func'
        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:1070:in 'block in MakeMakefile#checking_for'
        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:370:in 'block (2 levels) in MakeMakefile::Logging.postpone'
        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:340:in 'MakeMakefile::Logging.open'
        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:370:in 'block in MakeMakefile::Logging.postpone'
        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:340:in 'MakeMakefile::Logging.open'
        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:366:in 'MakeMakefile::Logging.postpone'
        from /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/mkmf.rb:1069:in 'MakeMakefile#checking_for'
        from extconf.rb:5:in 'Object#have_builtin_func'
        from extconf.rb:18:in '<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/private/var/folders/cp/kp1z7bk902qd09vnskdwr11r0000gp/T/tmp.Y8OnNpuhoj/.devbox/virtenv/ruby/extensions/arm64-darwin-24/3.4.0/bigdecimal-3.1.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /private/var/folders/cp/kp1z7bk902qd09vnskdwr11r0000gp/T/tmp.Y8OnNpuhoj/.devbox/virtenv/ruby/gems/bigdecimal-3.1.9
for inspection.
Results logged to
/private/var/folders/cp/kp1z7bk902qd09vnskdwr11r0000gp/T/tmp.Y8OnNpuhoj/.devbox/virtenv/ruby/extensions/arm64-darwin-24/3.4.0/bigdecimal-3.1.9/gem_make.out

  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/rubygems/ext/builder.rb:125:in 'Gem::Ext::Builder.run'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/rubygems/ext/ext_conf_builder.rb:28:in 'Gem::Ext::ExtConfBuilder.build'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/rubygems/ext/builder.rb:193:in 'Gem::Ext::Builder#build_extension'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/rubygems/ext/builder.rb:227:in 'block in Gem::Ext::Builder#build_extensions'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/rubygems/ext/builder.rb:224:in 'Array#each'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/rubygems/ext/builder.rb:224:in 'Gem::Ext::Builder#build_extensions'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/rubygems/installer.rb:844:in 'Gem::Installer#build_extensions'
/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/rubygems_gem_installer.rb:111:in
'Bundler::RubyGemsGemInstaller#build_extensions'
/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/rubygems_gem_installer.rb:30:in
'Bundler::RubyGemsGemInstaller#install'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/source/rubygems.rb:205:in 'Bundler::Source::Rubygems#install'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/installer/gem_installer.rb:55:in 'Bundler::GemInstaller#install'
/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/installer/gem_installer.rb:17:in
'Bundler::GemInstaller#install_from_spec'
/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/installer/parallel_installer.rb:133:in
'Bundler::ParallelInstaller#do_install'
/nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/installer/parallel_installer.rb:124:in 'block in
Bundler::ParallelInstaller#worker_pool'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/worker.rb:62:in 'Bundler::Worker#apply_func'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/worker.rb:57:in 'block in Bundler::Worker#process_queue'
  <internal:kernel>:168:in 'Kernel#loop'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/worker.rb:54:in 'Bundler::Worker#process_queue'
  /nix/store/jy0inyrnpg1596p95qa5g76fwxa5aj33-ruby-3.4.1/lib/ruby/3.4.0/bundler/worker.rb:90:in 'block (2 levels) in Bundler::Worker#create_threads'

An error occurred while installing bigdecimal (3.1.9), and Bundler cannot continue.

In Gemfile:
  bigdecimal
@jay-aye-see-kay jay-aye-see-kay added bug Something isn't working triage Issue needs triage labels Feb 3, 2025
@jay-aye-see-kay
Copy link
Contributor Author

While looking into this something else surprised me, devbox adds this old version of clang to all projects by default, I would have expected it to default to the system version, or at least a more recent clang version.

# macOS system version (via with xcode-tools)
cd $HOME && which clang && clang version # v16.0.0

# devbox provides a quite old version of clang in a blank project
cd (mktemp -d) && devbox init && devbox run 'which clang && clang --version' # v11.1.0

Is this behaviour intentional?

aviav added a commit to aviav/jekyll-docker that referenced this issue Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs triage
Development

No branches or pull requests

1 participant