2011-08-14 169 views
8

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

红宝石debug19我有越来越调试在Ruby 1.9.3发布preview1工作的一些问题。

我已经安装了1.9.3使用RVM使用下面的命令:

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

并安装红宝石debug19本:

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

调试宝石安装正常,但当我去通过调试打开控制台或尝试使用调试标志rails c --debugrspec spec --debug。我得到以下错误:

/Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/mario/.rvm/gems/[email protected]/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/[email protected]/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle 
    Expected in: flat namespace 
in /Users/mario/.rvm/gems/[email protected]/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /Users/mario/.rvm/gems/[email protected]/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/mario/.rvm/gems/[email protected]/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency' 
    from /Users/mario/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require' 
    from /Users/mario/.rvm/gems/[email protected]/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>' 
    from /Users/mario/.rvm/gems/[email protected]/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `require' 
    from /Users/mario/.rvm/gems/[email protected]/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `block (2 levels) in require' 
    from /Users/mario/.rvm/gems/[email protected]global/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `each' 
    from /Users/mario/.rvm/gems/[email protected]/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `block in require' 
    from /Users/mario/.rvm/gems/[email protected]/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `each' 
    from /Users/mario/.rvm/gems/[email protected]/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `require' 
    from /Users/mario/.rvm/gems/[email protected]/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/[email protected]/gems/railties-3.0.9/lib/rails/commands.rb:21:in `require' 
    from /Users/mario/.rvm/gems/[email protected]/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>' 
+0

你是走在最前沿,狮子和1.9.3预览之间。你可能想直接联系作者/支持者进行ruby-debug。 –

+0

是的,我意识到,我想我会问这个问题,看看是否有人有解决方案,或者如果有什么我错过了。如果没有人提出任何事情,我会记录一张票。 –

+0

请参阅http://stackoverflow.com/questions/6438116/rails-with-ruby-debugger-throw-symbol-not-found-ruby-current-thread-loaderror/7096617#7096617 –

回答

0

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

摘录:

First download linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem from http://rubyforge.org/frs/?group_id=8883 , then …

$ 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 
+1

只有链接的答案没有用,如果链接将来消失。你能总结或解释它在那里说的吗? –

13

下面是一个alternate solution I found in a Gist通过rafaeldx7

基本上,解决方案是使用一对夫妇库,linecache19 v0.5.13 & 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." 
+3

不要错过隐藏在评论中的简单安装:'bash <<(curl -L https://raw.github.com/gist/1333785)' –

+0

或者,对于没有ruby源代码的rbenv用户(替换你的ruby版本号):'gem install linecache19-0.5.13.gem ruby​​-debug-base19-0.11.26.gem - --with-ruby-include =〜/ .rbenv/versions/1.9。 3-p125/include/ruby​​-1.9.1/ruby​​-1.9.3-p125' – gerrit

7

编辑:首先,git-pinning解决方案工作,但我一直没有能够使用它。我将它留在这里是因为人们已经投票赞成它,但是我认为我的ruby-debug CLI是偶然的,因为它是以非常规方式打包的。

我推荐使用pry代替;它似乎是红宝石调试和更多。此外,我还用了require 'debug'一段时间,在答案的顶部提到了(也可能是什么人投票),并且它使您投入的范围通常不是您所期望的。再次使用pry(并且注意,如果您需要类似调试器的步进,您还需要this pry plugin,我还没有需要/测试)。


Rails with ruby-debugger throw 'Symbol not found: _ruby_current_thread (LoadError)'(小结:你可以用1.9s内置调试器现在)只是之后我想通了以下内容:

因为我注意到你的努力得到它与Rails的工作,如果你正在使用的捆绑,你可以添加到您的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 
+1

即使这样,我仍然无法加载这样的文件 - ruby​​-debug,即使我说:require =>'ruby-debug ' –

+0

是的,我一定有一些设置恰到好处。我不能在另一个项目上复制它。问题是ruby-debug-base19的'package'任务会产生两个gem,一个用于base,另一个用于CLI解释器。看起来这些曾经是两个项目,但合并?不知道为什么,但它使它很难像这样使用。无论如何,更新我的解决方案,建议'撬' – Woahdae

0

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

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

$ 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 

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

$ 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 

现在,你可以参考你的Gemfile这些目录使用:path指令。如果你有一个本地的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 
3

我创建了一个RubyGems的回购与1.9.3的最新版本。

只需添加您的Gemfile这个源代码行,它的所有设置:

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

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

干得好!我很厌倦重新学习如何在每个项目上处理这个问题! – Troy