2

Ruby 3.1.0

Rails 7.0.2.2 (with bundling and Postgresql)

I keep getting this strange crash on puma 5.6.2 when running bundle install.

% bundle install           
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 13.0.6
Using racc 1.6.0
Using crass 1.0.6
Using minitest 5.15.0
Using builder 3.2.4
Using digest 3.1.0
Using rack 2.2.3
Using io-wait 0.2.1
Using concurrent-ruby 1.1.9
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.2
Using bundler 2.3.3
Using timeout 0.2.0
Using nio4r 2.5.8
Using strscan 3.0.1
Using bindex 0.8.1
Using public_suffix 4.0.6
Using thor 1.2.1
Using erubi 1.10.0
Using matrix 0.4.2
Using regexp_parser 2.2.1
Using childprocess 4.1.0
Using method_source 1.0.0
Using redis 4.6.0
Using zeitwerk 2.5.4
Using io-console 0.5.11
Using diff-lcs 1.5.0
Using ffaker 2.20.0
Using pg 1.3.3
Using msgpack 1.4.5
Using rexml 3.2.5
Using rspec-support 3.11.0
Using rubyzip 2.3.2
Using net-protocol 0.1.2
Using rack-test 1.1.0
Using i18n 1.10.0
Using tzinfo 2.0.4
Using reline 0.3.1
Using sprockets 4.0.3
Using mail 2.7.1
Using nokogiri 1.13.3 (arm64-darwin)
Using rspec-mocks 3.11.0
Using websocket-driver 0.7.5
Using bootsnap 1.10.3
Using net-pop 0.1.1
Fetching puma 5.6.2
Using rspec-expectations 3.11.0
Using irb 1.4.1
Using net-imap 0.2.3
Using loofah 2.14.0
Using net-smtp 0.3.1
Using debug 1.4.0
Using rails-html-sanitizer 1.4.2
Using selenium-webdriver 4.1.0
Using rspec-core 3.11.0
Using xpath 3.2.0
Using webdrivers 5.0.0
Using addressable 2.8.0
Using activesupport 7.0.2.2
Using rails-dom-testing 2.0.3
Using globalid 1.0.0
Using activemodel 7.0.2.2
Using capybara 3.36.0
Using activerecord 7.0.2.2
Using factory_bot 6.2.0
Using actionview 7.0.2.2
Using activejob 7.0.2.2
Using actionpack 7.0.2.2
Using jbuilder 2.11.5
Using actioncable 7.0.2.2
Using activestorage 7.0.2.2
Using actionmailer 7.0.2.2
Using actionmailbox 7.0.2.2
Using railties 7.0.2.2
Using actiontext 7.0.2.2
Using sprockets-rails 3.4.2
Using turbo-rails 1.0.1
Using cssbundling-rails 1.1.0
Using rails 7.0.2.2
Using jsbundling-rails 1.0.2
Using rspec-rails 5.1.1
Using stimulus-rails 1.0.4
Using web-console 4.2.0
Using factory_bot_rails 6.2.0
Installing puma 5.6.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/jason/.rvm/gems/ruby-3.1.0/gems/puma-5.6.2/ext/puma_http11
/Users/jason/.rvm/rubies/ruby-3.1.0/bin/ruby -I /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0 -r
./siteconf20220307-61890-nqajx8.rb extconf.rb --with-cflags\=-Wno-error\=implicit-function-declaration
checking for BIO_read() in -lcrypto... *** 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
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/jason/.rvm/rubies/ruby-3.1.0/bin/$(RUBY_BASE_NAME)
    --with-puma_http11-dir
    --without-puma_http11-dir
    --with-puma_http11-include
    --without-puma_http11-include=${puma_http11-dir}/include
    --with-puma_http11-lib
    --without-puma_http11-lib=${puma_http11-dir}/lib
    --with-openssl-dir
    --without-openssl-dir
    --with-openssl-include
    --without-openssl-include=${openssl-dir}/include
    --with-openssl-lib
    --without-openssl-lib=${openssl-dir}/lib
    --with-openssl-config
    --without-openssl-config
    --with-pkg-config
    --without-pkg-config
    --with-crypto-dir
    --without-crypto-dir
    --with-crypto-include
    --without-crypto-include=${crypto-dir}/include
    --with-crypto-lib
    --without-crypto-lib=${crypto-dir}/lib
    --with-cryptolib
    --without-cryptolib
/Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:498:in `try_do': The compiler failed to generate an executable
file. (RuntimeError)
You have to install development tools first.
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:591:in `try_link0'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:609:in `try_link'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:830:in `try_func'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:1065:in `block in have_library'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:1007:in `block in checking_for'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:362:in `block (2 levels) in postpone'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:332:in `open'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:362:in `block in postpone'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:332:in `open'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:358:in `postpone'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:1006:in `checking_for'
    from /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/mkmf.rb:1060:in `have_library'
    from extconf.rb:17:in `block in <main>'
    from extconf.rb:17:in `each'
    from extconf.rb:17:in `find'
    from extconf.rb:17:in `<main>'

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

  /Users/jason/.rvm/gems/ruby-3.1.0/extensions/arm64-darwin-20/3.1.0/puma-5.6.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/jason/.rvm/gems/ruby-3.1.0/gems/puma-5.6.2 for inspection.
Results logged to /Users/jason/.rvm/gems/ruby-3.1.0/extensions/arm64-darwin-20/3.1.0/puma-5.6.2/gem_make.out

  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in `run'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/tempfile.rb:317:in `open'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in `build_extension'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `each'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/rubygems/installer.rb:847:in `build_extensions'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/source/rubygems.rb:204:in `install'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:54:in `install'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:186:in `do_install'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:62:in `apply_func'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:57:in `block in process_queue'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:54:in `loop'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:54:in `process_queue'
  /Users/jason/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing puma (5.6.2), and Bundler cannot continue.

In Gemfile:
  puma

I've already tried xcode-select --install but this does not fix the problem

I have the fix in an answer below, but can someone please explain what it is doing and why forcing the install from rubygems source seems to fix the problem?

Jason FB
  • 4,752
  • 3
  • 38
  • 69
  • had a similar problem, this https://stackoverflow.com/questions/64070241/install-ruby-development-tools-for-gem-installation-on-osx-catalina did the trick – python00b Jun 01 '23 at 14:27

1 Answers1

11

the fix for this is to install it from the source.

although the message says the xcode-select tools are missing, this is not the problem.

gem install puma -v '5.6.2' --source 'https://rubygems.org/'

once I do this, I can then re-run bundle install successfully.

Jason FB
  • 4,752
  • 3
  • 38
  • 69
  • This way failed from my side then I Solved the mine with this `gem install puma:4.3.5 -- --with-cflags="-Wno-error=implicit-function-declaration"` after that update your gemfile with this gem `"puma", "~> 4.3.5"` – Houndjetode Noukpo Herve Dec 17 '22 at 09:13