Search code examples
ruby-on-railsbundlepuma

bundle install fails after installing puma


I'm running bundle install and it failed in the middle with the error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/Mahmoud/dev-reps/non-docker/normal/vendor/bundle/ruby/2.5.0/gems/puma-4.3.1/ext/puma_http11
/Users/Mahmoud/.rbenv/versions/2.5.5/bin/ruby -r ./siteconf20220308-96584-8zjcoy.rb extconf.rb --with-cppflags=-I/usr/local/opt/openssl/include
checking for BIO_read() in -lcrypto... yes

...
...
An error occurred while installing puma (4.3.1), and Bundler cannot continue.
Make sure that `gem install puma -v '4.3.1' --source 'http://rubygems.org/'` succeeds before bundling.

After some failures to install puma, and after much searching and many trials, I was able to install it through:

gem install puma:4.3.1 -- --with-cflags="-Wno-error=implicit-function-declaration"

and the gem installed successfully, giving:

Building native extensions with: '--with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
Successfully installed puma-4.3.1
Parsing documentation for puma-4.3.1
Done installing documentation for puma after 0 seconds
1 gem installed

My problem currently is that trying bundle install again still fails with the same error. Tried restarting terminal, but still same. It's as if puma has not been installed at all. What am I doing wrong?


Solution

  • Finally got bundle to work using:

    bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"
    

    from this answer here