LoginSignup
26
21

More than 5 years have passed since last update.

Ruby 2.2.0 で json gem がインストールできなかったので対処した

Last updated at Posted at 2015-01-06

Ruby 2.2.0 で CocoaPods のインストールに失敗した。 cocoapods-0.35.0 が依存する json-1.8.1 の native extension のビルドに失敗するようだ:

% gem install cocoapods
Building native extensions.  This could take a while...
ERROR:  Error installing cocoapods:
        ERROR: Failed to build gem native extension.

(略)

compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                              ^
(略)

make failed, exit code 2

Gem files will remain installed in /Users/uasi/.rbenv/gems/2.2.0/gems/json-1.8.1 for inspection.
Results logged to /Users/uasi/.rbenv/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.1/gem_make.out

以下の手順で json-1.8.1 にパッチを当てて対処した:

cd ~/tmp

# json gem を取得して展開
gem fetch json -v 1.8.1
gem unpack json-1.8.1.gem

# ソースにパッチを当てる
cd json-1.8.1
curl -s https://patch-diff.githubusercontent.com/raw/flori/json/pull/231.patch | git --git-dir= apply -

# gem をパッケージングしてインストール
gem build json.gemspec
gem install ./json-1.8.1.gem
#gem install -i ../vendor/bundle ./json-1.8.1.gem # Bundler 向け

# 後片付け
cd ..
rm -r json-1.8.1 json-1.8.1.gem

# cocoapods をインストール
gem install cocoapods
26
21
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
26
21