puma gem - Failed to build gem native extension

守給你的承諾、 提交于 2019-11-29 20:11:42

Try the following

gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include
bundle install

You can also specify the gem version, like the following:

gem install puma -v '2.11.3' -- --with-cppflags=-I/usr/local/opt/openssl/include

I'm on OS X 10.12.4 and the comment @mahi added worked for me:

gem install puma -v '3.6.0' -- --with-opt-dir=/usr/local/opt/openssl

I had similar issue on OSx El Capitan. In order to fix the issue I had to do:

brew install openssl
brew link --force openssl

libssl1.0-dev installing helped to me. Try

apt-get install libssl1.0-dev

and then

gem install puma

I've run into a similar error under Mac OS X 10.10.

Details in the mkmf.log showed that this was due to:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

Which was caused by the installation of a new version of Xcode. This was easily solved by accepting the Xcode license from Apple:

sudo xcodebuild -license

Hope this might help someone in the future ;-)

It could be an open ssl error

gem install puma -v 2.11.2 -- --with-opt-dir=/usr/local/opt/openssl
morgler

When using bundler and homebrew:

$ bundle config build.puma --with-cppflags=-I$(brew --prefix openssl)/include
$ bundle install

I copied and adapted this answer from Lloeki here: https://stackoverflow.com/a/31516586/704499

I had to do this beforehand: sudo apt-get install libgmp3-dev

Have you tried

DISABLE_SSL=true gem install puma

Specify the version if you have version specific requirement like:

DISABLE_SSL=true gem install puma -v version_number
Amod Pandey

The gem is looking for ssl libraries. So we have to provide the path to the lib containing the ssl lib

e.g. /usr/share/openssl

In my case the the ssl lib "libcrypto" was in /usr/local/lib. So let's pass /usr/local to it (excluding lib word).

For gem install

gem install puma -- --with-opt-dir=/usr/local

For bundle install

bundle config build.puma --with-opt-dir=/usr/local
bundle install

notice the name build.puma. where puma is the name of the gem.

The build config command adds the following to ~/.bundle/config

---
BUNDLE_BUILD__PUMA: "--with-opt-dir=/usr/local"

Run brew info openssl and follow the instructions there. Do not try to --force link the latest openssl with the one that comes installed with OSX by default. (0.9.8)

Specifically it'll ask you to add the Homebrew version of openssl (should be 1.0.2 as of this date) into your $PATH.
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

Note: Make sure to remove any export PATH lines from the bash_profile, since this line above exports it for you appending the rest of the $PATH variable to the end. To view the bash profile use vi ~/.bash_profile

This fixed the problems for installing ruby gems that require compilation. (Puma in this case)

Install these packages.

apt-get install openssl ruby-openssl libssl-dev

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!