ruby-debug19 on ruby​​-1.9.3-preview1

可能重复:
Rails 3.1和Ruby 1.9.3p125:ruby-debug19仍然崩溃,“找不到符号:_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 `' 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 `' 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 `' 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 `' from script/rails:6:in `require' from script/rails:6:in `' 

这是我在 rasseldx7 的Gist中找到的替代解决方案 。

基本上,解决方案是使用一些库的更新版本, 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." 

编辑:git-pinning解决方案起初工作,但我一直无法使用它。 我会把它留在这里,因为人们对它进行了投票,但我认为我的ruby-debug CLI是偶然的,因为它是以非传统的方式打包的。

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


使用ruby-debugger抛出’Rails’找到符号:_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 

我用1.9.3的最新版本创建了一个Rubygems repo。

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

 source 'http://rubydebug19.s3.amazonaws.com' gem 'ruby-debug19', :group => :development 

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

摘自该网站:

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

 $ 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 

以下是我使用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 

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

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