gem 在 Mac OS Big Sur Ruby 2.6.3 Bundler 版本 2.2.19 上安装 puma -v '4.3.7' 失败
gem install puma -v '4.3.7' fails on Mac OS Big Sur Ruby 2.6.3 Bundler version 2.2.19
症状:gem 安装 puma -v '4.3.7' 崩溃
• Mac OS 大苏尔 11.4
• Ruby 2.6.3
• 捆绑器版本 2.2.19
• 自制软件 3.1.9
jason@ % gem install puma -v '4.3.7' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
current directory: /Users/jason/.rvm/gems/ruby-2.6.3/gems/puma-4.3.7/ext/puma_http11
/Users/jason/.rvm/rubies/ruby-2.6.3/bin/ruby -I /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210611-75981-19nb5m9.rb extconf.rb
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
--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-2.6.3/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-cryptolib
--without-cryptolib
/Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:467: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-2.6.3/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:1016:in `block in have_library'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:1011:in `have_library'
from extconf.rb:13:in `block in <main>'
from extconf.rb:13:in `each'
from extconf.rb:13:in `find'
from extconf.rb:13: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-2.6.3/extensions/-darwin-20/2.6.0/puma-4.3.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/jason/.rvm/gems/ruby-2.6.3/gems/puma-4.3.7 for inspection.
Results logged to /Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/puma-4.3.7/gem_make.out
jason@ %
这里是mfmk.log
jason@ % more /Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/puma-4.3.7/mkmf.log
"gcc -o conftest -I/Users/jason/.rvm/rubies/ruby-2.6.3/include/ruby-2.6.0/-darwin20 -I/Users/jason/.rvm/rubies/ruby-2.6.3/include/ruby-2.6.0/ruby/backward -I/Users/jason/.rvm/rubies/ruby-2.6.3/include/ruby-2.6.0 -I. -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wno-error=implicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/jason/.rvm/rubies/ruby-2.6.3/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -lruby.2.6 "
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
当您安装 GCC 失败或 xcode-select
时会出现这种情况
确保安装了 xcode-select
xcode-select --安装
确保你安装的 puma 版本
gem install puma -v 'x.y.z'
- 如果这些都不起作用,请尝试
bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"
然后再运行bundle install
我在尝试为 Jekyll 安装 gem 时遇到了同样的问题。
xcode-select --安装
这解决了问题。
我从这里 https://developer.apple.com/download/all/ 下载并安装了“Xcode 13 的命令行工具”,它解决了我的问题。 xcode-select --install 说要花一个多小时。
症状:gem 安装 puma -v '4.3.7' 崩溃
• Mac OS 大苏尔 11.4
• Ruby 2.6.3
• 捆绑器版本 2.2.19
• 自制软件 3.1.9
jason@ % gem install puma -v '4.3.7' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
current directory: /Users/jason/.rvm/gems/ruby-2.6.3/gems/puma-4.3.7/ext/puma_http11
/Users/jason/.rvm/rubies/ruby-2.6.3/bin/ruby -I /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210611-75981-19nb5m9.rb extconf.rb
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
--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-2.6.3/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-cryptolib
--without-cryptolib
/Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:467: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-2.6.3/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:1016:in `block in have_library'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /Users/jason/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/mkmf.rb:1011:in `have_library'
from extconf.rb:13:in `block in <main>'
from extconf.rb:13:in `each'
from extconf.rb:13:in `find'
from extconf.rb:13: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-2.6.3/extensions/-darwin-20/2.6.0/puma-4.3.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/jason/.rvm/gems/ruby-2.6.3/gems/puma-4.3.7 for inspection.
Results logged to /Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/puma-4.3.7/gem_make.out
jason@ %
这里是mfmk.log
jason@ % more /Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/puma-4.3.7/mkmf.log
"gcc -o conftest -I/Users/jason/.rvm/rubies/ruby-2.6.3/include/ruby-2.6.0/-darwin20 -I/Users/jason/.rvm/rubies/ruby-2.6.3/include/ruby-2.6.0/ruby/backward -I/Users/jason/.rvm/rubies/ruby-2.6.3/include/ruby-2.6.0 -I. -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wno-error=implicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/jason/.rvm/rubies/ruby-2.6.3/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -lruby.2.6 "
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
当您安装 GCC 失败或 xcode-select
时会出现这种情况确保安装了 xcode-select
xcode-select --安装
确保你安装的 puma 版本
gem install puma -v 'x.y.z'
- 如果这些都不起作用,请尝试
bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"
然后再运行bundle install
我在尝试为 Jekyll 安装 gem 时遇到了同样的问题。
xcode-select --安装
这解决了问题。
我从这里 https://developer.apple.com/download/all/ 下载并安装了“Xcode 13 的命令行工具”,它解决了我的问题。 xcode-select --install 说要花一个多小时。