3

我正在尝试安装 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...

所以我研究了这个问题,最后看到了这个帖子:

如何在 ruby​​ 1.9.3 / Rails 3.2.1 中安装 ruby​​-debug

一切正常,直到我尝试了命令:

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 下载到一个文件夹中,然后运行以下命令:

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 时添加的调试器 gem,但这并没有改变任何东西。

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

4

3 回答 3

0

我知道这个问题已经很老了,但是今天我遇到了同样的错误,这是我在谷歌上搜索错误时的第一个结果。

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

gem install debugger

在捆绑之前修复它。

于 2014-06-26T16:07:14.173 回答
0

刚刚通过 RVM 安装了 Ruby 2.0.0 就遇到了这个问题。

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

rvm reinstall 2.0.0 --disable-binary
于 2014-10-27T18:40:04.527 回答
0

ruby-debug 对于 ruby​​ 1.9 已损坏,请尝试“pry”。也许可以让 ruby​​-debug 工作,但我不会指望它。

在 ruby​​ 1.9 中调试

于 2012-07-27T01:22:12.303 回答