ruby-debug19 on ruby​​-1.9.3-preview1

时间:2011-08-14 04:07:57

标签: ruby debugging rubygems

  

可能重复:
  Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with “Symbol not found: _ruby_threadptr_data_type”

我在使用ruby 1.9.3 preview1版本进行调试时遇到了一些问题。

我使用rvm使用以下命令安装了1.9.3:

rvm install 1.9.3 --reconfigure --debug -C --enable-pthread

用这个安装ruby-debug19:

gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-preview1

调试gem安装正常,但是当我打开一个带调试的控制台或尝试使用调试标志rails c --debugrspec spec --debug时。我收到以下错误:

/Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle, 9): Symbol not found: _ruby_current_thread (LoadError)
  Referenced from: /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
  Expected in: flat namespace
 in /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `each'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `each'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler.rb:120:in `require'
    from /Users/mario/Work/project/config/application.rb:7:in `<top (required)>'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/railties-3.0.9/lib/rails/commands.rb:21:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/railties-3.0.9/lib/rails/commands.rb:21:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

6 个答案:

答案 0 :(得分:13)

这是alternate solution I found in a Gist rafaeldx7

基本上,解决方案是使用几个库的更新版本linecache19 v0.5.13&amp; ruby-debug-base19 v0.11.26,但这些都不在RubyGem仓库中。

# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

echo "Installing ruby-debug with ruby-1.9.3-p0 ..."

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

gem install linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p0/

rm linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem

echo "Done."

答案 1 :(得分:7)

编辑:git-pinning解决方案起初工作,但我还没有能够始终如一地使用它。我将它留在这里是因为人们对它进行了投票,但我认为我的ruby-debug CLI是偶然的,因为它以非传统的方式打包。

我建议改用pry;它似乎是ruby-debug等等。此外,我已经使用了require 'debug'一段时间,在答案的顶部提到(可能是人们正在推荐的内容),而且它让你放弃的范围通常不是你所期望的。再次,使用pry(并注意,如果你想要类似调试器的步进,你还需要this pry plugin,我还没有需要/测试过。)


Saw Rails with ruby-debugger throw 'Symbol not found: _ruby_current_thread (LoadError)'(摘要:你现在可以使用1.9s内置的调试器)刚刚找到以下内容之后:

由于我注意到您正试图让它与Rails一起使用,如果您正在使用bundler,您可以将其添加到您的gemfile中:

gem 'linecache19', :git => 'https://github.com/mark-moseley/linecache.git' 
gem 'ruby-debug-base19', :git => 'https://github.com/mark-moseley/ruby-debug.git'

然后执行:

bundle config build.ruby-debug-base19 --with-ruby-include="$rvm_path/src/$(rvm tools strings)/"
bundle install

答案 2 :(得分:3)

我创建了一个Rubygems repo,其最新版本为1.9.3。

只需在Gemfile上添加此源代码行即可:

source 'http://rubydebug19.s3.amazonaws.com'

gem 'ruby-debug19', :group => :development

答案 3 :(得分:0)

这是一个临时解决方案:http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

摘自该网站:

  

首先下载linecache19-0.5.13.gem和   ruby-debug-base19-0.11.26.gem来自   http://rubyforge.org/frs/?group_id=8883,然后......

$ 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=/Users/santiago/.rbenv/source/ruby-1.9.3-p0  
Building native extensions.  This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
$ irb
irb(main):001:0> require 'ruby-debug'
=> true

答案 4 :(得分:0)

以下是我使用Bundler 1.x和Ruby 1.9.3-p0(已发布的稳定版)的方法。希望这很快就会过时,但同时这是一个可行的解决方案,如果这是你需要的。

首先,将linecache和ruby-debug-base gems安装为系统gem。请注意,我从不同的地方得到了这些。

$ curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
$ gem install linecache19-0.5.13.gem
$ gem install --pre ruby-debug-base19x # installs ruby-debug-base19x-0.11.30.pre4

接下来,为每个已安装的gem重新创建gem源:

$ mkdir ~/src/linecache19
$ cd /r193 # where your 1.9.3 is installed; system dependent
$ cd lib/ruby/gems/1.9.1 # where your gems are, should be the same
$ cp specifications/linecache19.gemspec ~src/linecache19
$ cp -r gems/linecache19-0.5.13/* ~/src/linecache19

$ mkdir ~/src/ruby-debug-base19x
$ cp specifications/ruby-debug-base19x-0.11.30.pre4.gemspec ~/src/ruby-debug-base19x
$ cp -r ruby-debug-base19x-0.11.30.pre4/* ~/src/ruby-debug-base19x

现在,您可以使用:path指令在Gemfile中引用这些目录。如果你有一个本地git存储库,你可以在那里添加提交那些目录并从你的Gemfile中引用它们,如下所示:

group :development do
  gem 'linecache19', '~>0.5.12', :git => 'git://git-repo/ruby/linecache19.git'
  gem 'ruby-debug-base19x', :git => 'git://git-repo/ruby/ruby-debug-base19x.git'
  gem 'ruby-debug19', :require => 'ruby-debug'
  gem 'ruby-prof'
end

答案 5 :(得分:0)

自1.9.3-p125以来,这些答案中的大多数已经过时了。

我在这里为ubuntu 11.10写了新的说明:https://gist.github.com/2218661