未能在macos-10.15.6上Bundle 安装puma 4.3.5或gem puma与ruby-2.6.6

XXXXXXXXXX

here is the error content:

fetching puma 4.3.5
Installing puma 4.3.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/lxj/.rvm/gems/ruby-2.6.6/gems/puma-4.3.5/ext/puma_http11
/Users/lxj/.rvm/rubies/ruby-2.6.6/bin/ruby -I /Users/lxj/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200731-28585-1eobsvu.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes
checking for DTLS_method() in openssl/ssl.h... yes
checking for TLS_server_method() in openssl/ssl.h... yes
checking for SSL_CTX_set_min_proto_version in openssl/ssl.h... yes
creating Makefile

current directory: /Users/lxj/.rvm/gems/ruby-2.6.6/gems/puma-4.3.5/ext/puma_http11
make "DESTDIR=" clean

current directory: /Users/lxj/.rvm/gems/ruby-2.6.6/gems/puma-4.3.5/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
ext/puma_http11/http11_parser.c:44:18: warning: unused variable 'puma_parser_en_main' [-Wunused-const-variable]
static const int puma_parser_en_main = 1;
                 ^
1 warning generated.
compiling io_buffer.c
compiling mini_ssl.c
mini_ssl.c:145:7: warning: unused variable 'min' [-Wunused-variable]
  int min, ssl_options;
      ^
mini_ssl.c:299:40: warning: function 'raise_error' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
void raise_error(SSL* ssl, int result) {
                                       ^
2 warnings generated.
compiling puma_http11.c
puma_http11.c:203:22: error: implicitly declaring library function 'isspace' with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
  while (vlen > 0 && isspace(value[vlen - 1])) vlen--;
                     ^
puma_http11.c:203:22: note: include the header <ctype.h> or explicitly provide a declaration for 'isspace'
1 error generated.
make: *** [puma_http11.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/lxj/.rvm/gems/ruby-2.6.6/gems/puma-4.3.5 for inspection.
Results logged to /Users/lxj/.rvm/gems/ruby-2.6.6/extensions/x86_64-darwin-19/2.6.0/puma-4.3.5/gem_make.out

An error occurred while installing puma (4.3.5), and Bundler cannot continue.
Make sure that `gem install puma -v '4.3.5'` succeeds before bundling.

In Gemfile:
  puma

推荐答案

最新版本的XCode tools(12 Beta 3)似乎安装了一个版本的Clang(MacOS上默认使用的C编译器),它在Puma本机扩展代码上使用的隐式函数上抛出了一个错误.

here所指出的解决方法是告诉Clang不要将此行为视为错误.

try run :

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

它应该会起作用.

Ruby相关问答推荐

Ruby:对于不存在的键,使用缺省值Hash在Hash中存储Hash

Ruby将字符串中的反斜杠替换为双反斜杠

清理 jruby 中输入数据的编码错误

这个#divmod 方法输出这个结果是做什么的?

如何用 yield_self 断链

类 SpecificationPolicy 的超类不匹配

Ruby - 将两个哈希与一些相似的键合并

RSpec 是否有 python 类似功能来做 TDD?

如何在没有继承方法的情况下获取类的公共方法?

RSpec: stubbing Kernel::sleep?

如何绘制 git repo 的代码行历史记录?

在 OSX 10.10 Yosemite 上安装 Nokogiri

Bundle不适用于 rbenv

Ruby全局匹配正则表达式?

我们什么时候在 Rails 中使用 "||=" 运算符?它的意义是什么?

Python 中的一切都像 Ruby 一样是对象吗?

我可以在 OS X v10.6.8 上升级到当前版本的 Ruby (2.2.3) 吗?

如何从字符串创建 Ruby 日期对象?

如何创建一个 Gemfile?

传递哈希而不是方法参数