Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What is going on with this article?
@fruitriin

[Ruby]Macでpumaがインストールできない[Railsとか]

pumaが原因でRailsがインストールできないんだなこれが。
sqliteがなくてインストールできないのはbrewからsqliteを入れれば解決するんだけど

macOS Catalina 10.15.6
ruby 2.6.5
gem 3.0.3
puma 4.3.5

似たような質問にxCodeがインストールされていないのでは?なんて回答もあったけど
手元ではそれで解決せず。

エラーメッセージ(クリックで展開)
gem install puma -v '4.3.5' --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/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.5/ext/puma_http11
/Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/bin/ruby -I /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20200810-80454-doo97b.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/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.5/ext/puma_http11
make "DESTDIR=" clean

current directory: /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/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/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-4.3.5 for inspection.
Results logged to /Users/rin.nakashima/.anyenv/envs/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/puma-4.3.5/gem_make.out

ググってたらissueを見つけまして、Mac側のデフォルトパラメータが変わってgccでのコンパイルがうまくできなくなったらしい。
https://github.com/puma/puma/issues/2304
ワークアラウンドとして以下のように対処せよとのこと

gem install puma:4.3.5 -- --with-cflags="-Wno-error=implicit-function-declaration
2
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
2
Help us understand the problem. What is going on with this article?