読者です 読者をやめる 読者になる 読者になる

waste of time

主にPHP

bundle installしたらeventmachineのインストールに失敗した件

たぶんまたハマるだろうからメモ。

事象

$ bundle install --path vendor/bundle
Fetching git://github.com/eventmachine/eventmachine.git
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Using backports 3.6.8
Using daemons 1.2.3
Using eventmachine 1.2.0.1 from git://github.com/eventmachine/eventmachine.git (at master@6580e27)

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/www/html/hoge/vendor/bundle/ruby/2.1.0/bundler/gems/eventmachine-6580e27f695d for inspection.
Results logged to /var/www/html/hoge/vendor/bundle/ruby/2.1.0/bundler/gems/extensions/x86_64-linux/2.1.0/eventmachine-6580e27f695d/gem_make.out
Using multi_json 1.12.1
Using rack 1.6.4
Using tilt 2.0.5
Using bundler 1.12.5
An error occurred while installing eventmachine (1.2.0.1), and Bundler cannot continue.

解決

$ sudo apt-get -y install ruby-dev ruby2.1-dev