LoginSignup
1
0

More than 3 years have passed since last update.

ちょ、Catalina、おま・・・(ry pumaが入らない編

Posted at

プロジェクトがコンテナ化されたのでローカルに環境を作る必要がでてきまして。
Rubyの静的解析ツールとしてrubocopを利用していたので、実行しようとしてみました。

環境: MacBookPro MacOS(10.15.7)

bundle exec rubocop
-bash: /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

げっ、動かん。
ruby2.3なんてもう使っとらんばい。これbundleをアップデートせなやん。

sudo gem update bundler
Updating installed gems
Updating bundler
Fetching bundler-2.1.4.gem
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Installing ri documentation for bundler-2.1.4
Installing darkfish documentation for bundler-2.1.4
Done installing documentation for bundler after 5 seconds
Parsing documentation for bundler-2.1.4
Done installing documentation for bundler after 2 seconds
Gems updated: bundler

動作確認

bundle -v
Bundler version 1.17.2

っしゃー!rubocop実行

bundle exec rubocop
bundler: command not found: rubocop
Install missing gem executables with `bundle install`

マジすか。システムに色々入るのは困るのでbundle install --path vendor/bundle指定かな

bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
(中略)
Installing puma 4.3.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3/ext/puma_http11
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20201102-12192-10ppsgh.rb extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
creating Makefile

current directory:
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3/ext/puma_http11
make "DESTDIR=" clean

current directory:
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
compiling mini_ssl.c
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
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/gems/puma-4.3.3
for inspection.
Results logged to
/path/to/pj-dir/vendor/bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/puma-4.3.3/gem_make.out

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

In Gemfile:
  puma

なんじゃこりゃあ!! Googleでmac puma make failedで検索してそれらしい記事を発見

https://qiita.com/fruitriin/items/5148632d301985094b10
上記によると、

Mac側のデフォルトパラメータが変わってgccでのコンパイルがうまくできなくなったらしい。
https://github.com/puma/puma/issues/2304

また Apple お前の仕業か!

上記issue ( https://github.com/puma/puma/issues/2304#issuecomment-664448309 ) にあった回避策

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

上記を実行してから bundle installすればよい、とのこと。

bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
(中略)
Installing puma 4.3.3 with native extensions
Installing rack-test 1.1.0
Installing rspec-support 3.8.2
Installing rspec-core 3.8.2
Installing rspec-expectations 3.8.4
Installing rspec-mocks 3.8.1
Installing rspec 3.8.0
Installing rubocop 0.74.0
(以下略)

ようやくrubocopがインストールされました。早速実行!

bundle exec rubocop
Inspecting 90 files
..........................................................................................

90 files inspected, no offenses detected

やったね!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0