我有标准的ruby-head和Rails 3.1rc4.我按照http://dirk.net/2010/04/17/ruby-debug-with-ruby-19x-and-rails-3-on-rvm/中的说明安装了ruby-debug.
但是当我运行rails s --debugger它会抛出这个奇怪的错误
/Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require': dlopen(/Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle, 9): Symbol not found: _ruby_current_thread (LoadError)
Referenced from: /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle
Expected in: flat namespace
in /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle - /Users/schovi/.rvm/gems/ruby-head/gems/linecache19-0.5.12/lib/trace_nums19.bundle
from /Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require'
from /Users/schovi/.rvm/gems/ruby-head/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
Run Code Online (Sandbox Code Playgroud)
任何的想法?谢谢,大卫
我听说有关ruby 1.9.3p125有解决ruby-debug19问题的传言,所以根据RVM网站上的说明,我重新安装了1.9.3:
$ rvm reinstall 1.9.3 --patch debug --force-autoconf
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.2.0]
Run Code Online (Sandbox Code Playgroud)
然后:
gem install ruby-debug19
Run Code Online (Sandbox Code Playgroud)
在我的Gemfile中添加了这个条目:
gem 'ruby-debug19'
Run Code Online (Sandbox Code Playgroud)
然后:
$ rails server -u
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
Run Code Online (Sandbox Code Playgroud)
为了解决这个错误,我将我的Gemfile条目更改为:
gem 'ruby-debug19', :require => …Run Code Online (Sandbox Code Playgroud) 可能重复:
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
Run Code Online (Sandbox Code Playgroud)
并安装了ruby-debug19:
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-preview1
Run Code Online (Sandbox Code Playgroud)
调试gem安装正常,但是当我打开一个调试控制台或尝试任何调试标志rails c --debug或rspec 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 …Run Code Online (Sandbox Code Playgroud) 当我尝试启动rails服务器时,rails s我收到此错误:
/home/james/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `require': /home/james/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/james/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError)
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `require'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.0/lib/bundler/runtime.rb:68:in `require'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.0/lib/bundler/runtime.rb:66:in `each'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.0/lib/bundler/runtime.rb:66:in `block in require'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.0/lib/bundler/runtime.rb:55:in `each'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.0/lib/bundler/runtime.rb:55:in `require'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.1.0/lib/bundler.rb:118:in `require'
from /home/james/rails-projs/macedonia_nato/config/application.rb:7:in `<top (required)>'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:53:in `require'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:53:in `block in <top (required)>'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:50:in `tap'
from /home/james/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Run Code Online (Sandbox Code Playgroud)
这是我的Gemfile:
source 'https://rubygems.org' …Run Code Online (Sandbox Code Playgroud)