3

I've just upgraded to ruby 1.9.3-p0 and rails 3.2.0. I'm now trying to debug an error in one of my tests using

rspec spec -d

But I get this error:

/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:422:in `rescue in debug=':  (RuntimeError)
**************************************************
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_threadptr_data_type - /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so

If you have it installed as a ruby gem, then you need to either require
'rubygems' or configure the RUBYOPT environment variable with the value
'rubygems'.

/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:408:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:408:in `debug='
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:19:in `block in configure'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `each'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `configure'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:21:in `run'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
/home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
**************************************************
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:407:in `debug='
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:19:in `block in configure'
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `each'
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/configuration_options.rb:18:in `configure'
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:21:in `run'
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
    from /home/map7/.rvm/gems/ruby-1.9.3-p0@rails3.2/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
map7
  • 5,096
  • 6
  • 65
  • 128

5 Answers5

10

Install the new debugger gem that works with Ruby 1.9.3 and 1.9.2:

https://github.com/cldwalker/debugger
Adrien Lamothe
  • 1,477
  • 1
  • 11
  • 14
  • Looks like the [debugger gem](https://github.com/cldwalker/debugger) is specifically designed to handle Ruby 1.9.2 and 1.9.3. It's a fork of ruby-debug19 ([Reason for Fork](http://rubydoc.info/gems/debugger/1.2.0/file/README.md#Reason_for_Fork)). See easy installation instructions in [this SO answer](http://stackoverflow.com/a/12294770/550712). – Mark Berry Sep 14 '12 at 20:22
  • For those using Debugger and still getting errors, see this [Github issue thread](https://github.com/cldwalker/debugger/issues/12). Some people had to manually install debugger dependencies. That thread wasn't exactly what I needed, but something in it led me to the solution I needed, which was to reinstall my rvm, rubies and gcc dependencies after migrating to a new system... – Eric Hu Nov 07 '12 at 23:32
4

Stick this in your Gemfile:

# one-liner to install these properly: bash < <(curl -L https://raw.github.com/gist/1333785)
gem 'linecache19', '0.5.13'
gem 'ruby-debug-base19', '0.11.26'

You'll need to run that one-liner in order for bundler to pick up the proper gems.

EDIT: I forgot to link to the posts I used to get debugging working:

Community
  • 1
  • 1
siannopollo
  • 1,464
  • 11
  • 24
2

I guess I can't comment on other answers yet, but I found many of these instructions don't mention you'll still need to include the

gem 'ruby-debug19', :require => 'ruby-debug'

line in your Gemfile, in addition to the instructions siannopollo provides. Without this, I get a 'cannot load such file -- ruby-debug' error (OSX, rvm, 1.9.3-p125).

FWIW, the gist is hardcoded to 1.9.3-p0, so if you're on 1.9.3-p125, you might need to edit it (also, generally a bad idea to execute a gist you haven't read).

mv_house
  • 51
  • 2
2

For me, all it took was:

gem 'debugger'

in the Gemfile

Neal
  • 4,468
  • 36
  • 33
1

Had to upgrade the following

bundle update ruby-debug-base19
map7
  • 5,096
  • 6
  • 65
  • 128