无法安装ruby-debug,错误:rb_method_entry_t.called_id

时间:2012-06-27 16:52:32

标签: ruby ruby-1.9.3 ruby-debug

我正在尝试安装ruby-debug。我使用的是Mac OS 10.7.4,XCode版本2308和Ruby版本1.9.3-p194。

按照此处的说明操作:http://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-ruby-debug,我尝试了

sudo gem install ruby-debug

我收到以下错误:

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug:
    ERROR: Failed to build gem native extension.

        /Users/andrew/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
*** 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
    --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/andrew/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-ruby-dir
    --without-ruby-dir
    --with-ruby-include
    --without-ruby-include=${ruby-dir}/include
    --with-ruby-lib
    --without-ruby-lib=${ruby-dir}/lib
extconf.rb:16:in `block in <main>': break from proc-closure (LocalJumpError)
from /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:18:in `call'
from /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:18:in `create_makefile_with_core'
from extconf.rb:32:in `<main>'


Gem files will remain installed in /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.26 for inspection.
Results logged to /Users/andrew/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-base19-0.11.26/ext/ruby_debug/gem_make.out

所以我尝试了以下命令:

sudo gem install debugger

导致:

Fetching: columnize-0.3.6.gem (100%)
Fetching: debugger-ruby_core_source-1.1.3.gem (100%)
Fetching: debugger-linecache-1.1.1.gem (100%)
Building native extensions. This could take a while...
Fetching: debugger-1.1.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed columnize-0.3.6
Successfully installed debugger-ruby_core_source-1.1.3
Successfully installed debugger-linecache-1.1.1
Successfully installed debugger-1.1.4
4 gems installed
Installing ri documentation for columnize-0.3.6...
Installing ri documentation for debugger-ruby_core_source-1.1.3...
Installing ri documentation for debugger-linecache-1.1.1...
Couldn't find file to include 'VERSION' from lib/linecache19.rb
Installing ri documentation for debugger-1.1.4...
Installing RDoc documentation for columnize-0.3.6...
Installing RDoc documentation for debugger-ruby_core_source-1.1.3...
Installing RDoc documentation for debugger-linecache-1.1.1...
Couldn't find file to include 'VERSION' from lib/linecache19.rb
Installing RDoc documentation for debugger-1.1.4...

所以我研究了这个问题,最后发现了这篇文章:

how do I install ruby-debug in ruby 1.9.3 / Rails 3.2.1

在我尝试命令之前一切正常:

gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p194

上面刚刚复制了第一个错误。所以我调查了

rb_method_entry_t.called_id

发现这篇文章:https://github.com/ruby/ruby/pull/56/#issuecomment-3463264

我尝试了他的建议步骤,除了rehash(我不知道如何处理rvm,并且不想切换到rbenv只是为了尝试它)。我将他推荐的所有宝石下载到一个文件夹,并运行以下命令:

gem install *.gem -- --with-ruby-include=$(echo ~/.rvm/rubies/1.9.3-p194/include/ruby-1.9.1/ruby-1.9.3-p194/) --no-rdoc --no-ri

它安装了linecache19-0.5.13,但它在ruby-debug-base19-0.11.26.gem上被阻塞,再次产生第一个错误。

我还尝试卸载运行sudo gem install debugger时添加的调试器gems,但这并未改变任何内容。

我不知道下一步该做什么。

3 个答案:

答案 0 :(得分:0)

对于ruby 1.9,ruby-debug被破坏了,试试看“pry”。也许有可能让ruby-debug工作,但我不会指望它。

Debugging in ruby 1.9

答案 1 :(得分:0)

我知道这个问题相当陈旧但我今天遇到了同样的错误,这是我谷歌错误时的第一个结果。

对我来说,调试器是作为依赖项安装并运行

gem install debugger

捆绑之前修复它。

答案 2 :(得分:0)

刚刚通过RVM安装了Ruby 2.0.0。

如果二进制文件可用,RVM将只安装二进制文件,速度更快,但调试器也需要源代码

rvm reinstall 2.0.0 --disable-binary