debugger gemをインストールしようとしたら、こんなエラーメッセージが出てしまいました。
$ gem install debugger -v '1.6.1'
ERROR: Error installing debugger:
ERROR: Failed to build gem native extension.
/Users/myname/.rbenv/versions/1.9.3-p545/bin/ruby extconf.rb --ruby=/Users/myname/.rbenv/versions/1.9.3-p545/bin/ruby --with-ruby-include=~/.rbenv/versions/1.9.3-p545/include
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p545 provided with debugger-ruby_core_source gem.
**************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/myname/.rbenv/versions/1.9.3-p545/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
Gem files will remain installed in /Users/myname/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/debugger-1.6.1 for inspection.
Results logged to /Users/myname/.rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/debugger-1.6.1/ext/ruby_debug/gem_make.out
原因
debuggerと依存関係のあるdebugger-ruby_core_sourceがサポートしているrubyバージョンよりも、インストール済のrubyバージョンのほうが新しい、というのが原因でした。
対処
対処方法は以下のうちどちらかをすればOKです。
- インストール対象のdebugger gemのバージョンを新しくする。
- 上記の例では
-v '1.6.1'
を指定していましたが、何も指定しなければ、通常は最新バージョンがインストールされるはず。 - Bundlerでインストールする時は、
bundle update
しておく。
- 上記の例では
- rubyのバージョンを古くする。
- 上記の例ではrubyのバージョンが
1.9.3-p545
でしたが、試しに1.9.3-p0
を使うようにしたらインストールできました。
- 上記の例ではrubyのバージョンが