如何在ruby 1.9.3 / Rails 3.2.1中安装ruby-debug [英] how do I install ruby-debug in ruby 1.9.3 / Rails 3.2.1

查看:141
本文介绍了如何在ruby 1.9.3 / Rails 3.2.1中安装ruby-debug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

/ b>

Possible Duplicate:
Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with “Symbol not found: _ruby_threadptr_data_type”

我已完成打印到控制台 - 我想向上移动到20世纪,并开始使用调试器!但是,我该如何安装ruby-debug?当我尝试安装ruby-debug19 gem时,本地编译的 ruby​​-debug.c 失败。我查看了其他SO帖子,但还没有找到答案...

I'm done with printing to the console -- I want to move up to the 20th century and start using a debugger!! But how do I install ruby-debug? The native compilation of ruby-debug.c fails when I try to install the ruby-debug19 gem. I've looked over other SO postings and haven't found the answer yet...


  • 我使用Ruby 1.9.3-p0

  • 我使用Rails 3.2(当然是使用Gemfile)

  • 我没有使用RVM,而是有一个完整的沙盒目录所有可执行文件,宝石,源代码等。我将它称为$ SANDBOX,下面...

如果我将ruby-debug19添加到我的Gemfile中,并执行 bundle install ,则在使用冲突的类型为'rb_iseq_compile_with_option'

If I add ruby-debug19 to my Gemfile and do bundle install, it fails during build with conflicting types for 'rb_iseq_compile_with_option':

# file: Gemfile
...
group :development do
  gem 'ruby-debug19'
end
...

% bundle install
...
Installing ruby-debug-base19 (0.11.25) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
        /Users/r/Developer/Topaz/usr/bin/ruby extconf.rb 
...
ruby_debug.c:29: error: conflicting types for 'rb_iseq_compile_with_option'
$SANDBOX/usr/include/ruby-1.9.1/ruby-1.9.3-p0/vm_core.h:505: error: previous declaration of 'rb_iseq_compile_with_option' was here
...
make: *** [ruby_debug.o] Error 1



gem从命令行安装ruby-debug doesn' t work



如果我尝试从命令行创建gem,则使用--with-ruby-include参数指向 include 目录为目前的红宝石,我得到了同样的错误:

gem install ruby-debug from the command line doesn't work

If I try building the gem from the command line, using the --with-ruby-include argument pointing at the include directory for the current ruby, I get the same error:

% gem install ruby-debug19 -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug19:
        ERROR: Failed to build gem native extension.

        $SANDBOX/usr/bin/ruby extconf.rb --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0/include
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... yes
checking for iseq.h... yes
checking for insns.inc... yes
checking for insns_info.inc... yes
checking for eval_intern.h... yes
creating Makefile

make
compiling breakpoint.c
compiling ruby_debug.c
ruby_debug.c:29: error: conflicting types for 'rb_iseq_compile_with_option'
$SANDBOX/usr/include/ruby-1.9.1/ruby-1.9.3-p0/vm_core.h:505: error: previous declaration of 'rb_iseq_compile_with_option' was here



我缺少什么?



是--with-ruby-include期望有什么不同?当前的ruby-debug19被破坏了吗?

what am I missing?

Is --with-ruby-include expecting something different? Is the current ruby-debug19 broken?

推荐答案

感谢@Marc Talbot在OP中的评论,我发现了一个工作配方。

Thanks to @Marc Talbot's comment in the OP, I found a working recipe.

% curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
% curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem



编译这两个宝石



compile the two gems

% gem install linecache19-0.5.13.gem
Building native extensions.  This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
...
% gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions.  This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
...



更新您的Gemfile



update your Gemfile

# file: Gemfile
...
group :development do
  gem 'linecache19', '0.5.13'
  gem 'ruby-debug-base19', '0.11.26'
  gem 'ruby-debug19', :require => 'ruby-debug'
end



安装并测试调试器



bundle install and test the debugger

% bundle install
Fetching source index for http://rubygems.org/
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
% irb
irb(main):001:0> require 'ruby-debug'
=> true
irb(main):002:0> debugger
$SANDBOX/usr/lib/ruby/1.9.1/irb/context.rb:166
@last_value = value
(rdb:1) p 'hooray'
"hooray"

希望这可以帮助其他人。

Hopefully this will help others.

这篇关于如何在ruby 1.9.3 / Rails 3.2.1中安装ruby-debug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆