santiago.pastorino

Ruby 1.9.3 and ruby-debug 33

Posted by santiago.pastorino
on Tuesday, November 01

As you probably know Ruby (MRI so brixen doesn’t get mad at me :P) 1.9.3 was released. I’ve been using 1.9.3 for a while now and as part of my RubyConf Uruguay talk I wanted to show ruby-debug. So my first attempt was:

$ gem install ruby-debug19
Fetching: linecache19-0.5.12.gem (100%)
Building native extensions.  This could take a while...
Fetching: ruby-debug-base19-0.11.25.gem (100%)
Building native extensions.  This could take a while...
Fetching: ruby-debug19-0.11.6.gem (100%)
Successfully installed linecache19-0.5.12
Successfully installed ruby-debug-base19-0.11.25
Successfully installed ruby-debug19-0.11.6
3 gems installed

Then require ‘ruby-debug’ and booom!!

$ irb
irb(main):001:0> require 'ruby-debug'
LoadError: dlopen(/Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle, 9): Symbol not found: _ruby_current_thread
  Referenced from: /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
  Expected in: flat namespace
 in /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from (irb):1
    from /Users/santiago/.rbenv/versions/1.9.3/bin/irb:12:in `<main>'

So after some research on the internet I found out that the author of ruby-debug had a fix for it which he considered unstable and didn’t push it to rubygems.org yet. Since I prefer an unstable ruby-debug than a non working one :P, I gave it a try …

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

and voilá.

So while we wait for an official release, you can enjoy a working ruby-debug.

| |

If you have found this material to be useful, you might
consider recommending me on Working With Rails.

Comments

Leave a response

  1. Boris Barroso Boris BarrosoNovember 01, 2011 @ 09:46 PM

    To install ruby-debug on Ubuntu ruby-1.9.3 you also need to download from http://rubyforge.org/frs/?group_id=8883

    linecache19-0.5.13.gem ruby_core_source-0.1.5.gem ruby-debug19-0.11.6.gem ruby-debug-base19-0.11.26.gem

    Then

    gem install archive-tar-minitar gem install linecache19-0.5.13.gem——with-ruby-include=/$rvm_src_path/ruby-1.9.3-p0 gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/$rvm_src_path/ruby-1.9.3-p0 gem install ruby-debug19-0.11.6.gem——with-ruby-include=/$rvm_src_path/ruby-1.9.3-p0

  2. Tom De Leu Tom De LeuNovember 01, 2011 @ 11:11 PM

    Thanks for this blog post. I don’t have a ~/.rbenv/source/ruby-1.9.3-p0 dir however. So, after looking around within the rbenv 1.9.3-p0 dir, this command did the trick:

    $ gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/tomdeleu/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0

  3. nfm nfmNovember 02, 2011 @ 12:51 AM

    Thanks so much spastorino, I’ve been trying to get this working for weeks!

  4. Thomas ThomasNovember 02, 2011 @ 11:32 AM

    Thank you so much.

    I little advice for RVM users:

    I had to provide another include path:

    gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/tvd/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/

    That worked for me.

  5. Michel Pigassou Michel PigassouNovember 02, 2011 @ 01:09 PM

    Do you manage to run the debugger inside a Rails 3 app?

  6. Boris Barroso Boris BarrosoNovember 03, 2011 @ 01:03 AM

    I have created a gist for ubuntu, Ruby 1.9.3 and ruby-debug with rvm https://gist.github.com/1331533 That should be clearer

  7. Karl KarlNovember 07, 2011 @ 04:05 PM

    Tried installing but i still end up with the following error:

    https://gist.github.com/dac9599762dc1c68f8ce

    Any ideas?

    thx!

  8. Ivan Storck Ivan StorckNovember 09, 2011 @ 05:49 AM

    This worked for me, but I also had to run ``` gem install ruby-debug19 ``` after downloading and installing the other two gems.

  9. Sheldon SheldonNovember 09, 2011 @ 10:33 PM

    In order to get debugger working on a Rails 3.1 server with RVM Ruby 1.9.3p0 I followed Boris Barroso’s instructions here: https://gist.github.com/1331533

    And then added the following to Gemfile: gem ‘ruby-debug19’, :require => ‘ruby-debug’

  10. pooscodormast pooscodormastNovember 11, 2011 @ 03:50 PM

    Hi! i’m repost you post: to my @vokvfqjt twitter

  11. Gerrit Kaiser Gerrit KaiserNovember 14, 2011 @ 07:45 PM

    @Karl: having the same problem here

    Ruby 1.9.3-p0 installed via rbenv

  12. stepchud stepchudNovember 18, 2011 @ 03:57 AM

    Thomas’s RVM advice helped me and I got it built. I’m running a MacBook Pro with Lion and just had to adjust the rvm path for /usr/local. By the way the auto-formatting kicked in on his comment. You have to pass a double-dash (two dash characters in a row) after the name of the gem (surrounded by spaces), then the config option name also starts with a double-dash.

    Thanks guys! I don’t know what I’d do without ruby-debug. :D

  13. Pablo Rozanski Pablo RozanskiNovember 18, 2011 @ 06:14 AM

    Thanks you for this post!!!

    with rvm I did

    gem install linecache19-0.5.13.gem

    gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/home/pabloroz/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/

    gem install ruby-debug19-0.11.6.gem——with-ruby-include=/home/pabloroz/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/

    and it worked

  14. Aleksey Trofimenko Aleksey TrofimenkoNovember 21, 2011 @ 09:28 PM

    any way to use bundler for it? prereleases or a git repo, maybe?

  15. Galen GalenNovember 30, 2011 @ 11:39 PM

    For me, after literally hours of trial-and-error, this worked for me (using RVM on Mac running Lion with Xcode 4.2.1):

    (Be sure to do “rvm 1.9.3” before running this also)

    gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/YOURUSERNAME/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/

    (If the following are two long dashes, replace the two long dashes above with hyphen hyphen space hyphen hyphen: - -)

  16. Deryl R. Doucette Deryl R. DoucetteDecember 06, 2011 @ 10:43 PM

    You can shorten the—with-ruby-include to—with-ruby-dir=$rvm_path/rubies/ruby-1.9.3-p0

    It should pick that up. if it doesn’t please file a bug with us. The—with-ruby-dir= should just make it all work.

  17. Phillip PhillipDecember 11, 2011 @ 03:31 AM

    I like to use

    $rvm_path/src/`rvm tools strings`

    for the with-ruby-dir / with-ruby-include switch. That way it works regardless which version of ruby I’m in or which gemset I’m in. As long as ‘rvm tools strings’ doesn’t change, that is. So my whole gem install line looks like this:

    gem install ruby-debug19——with-ruby-include=”$rvm_path/src/`rvm tools strings`”

    Oh, I’m currently using RVM 1.9.2. I don’t know when tools was introduced though.

  18. Phillip PhillipDecember 11, 2011 @ 04:31 AM

    On Mac OS X Lion 10.7.2 with Xcode 4.2.1 and RVM 1.9.2, this worked for me:

    https://gist.github.com/1457544

    This is basically the same thing that santiago.pastorino and others have said, but I wanted to make it available in clear, complete steps.

  19. googya googyaJanuary 07, 2012 @ 05:01 AM

    strangely I got a loadError in 1.9.3 version :

    LoadError: cannot load such file—ruby_debug.so

  20. eMancu eMancuJanuary 09, 2012 @ 06:21 PM

    Thanks Philip! that worked for me and was very clean!

  21. mina minaJanuary 20, 2012 @ 11:16 AM

    Hi, I am trying to install ruby-debug-base19-0.11.26.gem on OSX Lion. I get

    checking for rb_method_entry_t.called_id in method.h… no checking for rb_control_frame_t.method_id in method.h… no

    I also filed a gist for it, https://gist.github.com/1646085 will appreciate any help.

  22. Swapnil SwapnilJanuary 24, 2012 @ 10:39 PM

    Thanks a lot for the tip. I have been trying to install the debugger for almost a week now. I haven’t tested whether it works with the eclipse DLTK yet, but I’m at least happy that I was able to make a clean install at last :) Thanks again!!

  23. Rod McLaughlin Rod McLaughlinJanuary 27, 2012 @ 07:41 PM

    Thanks Santiago, and especially Boris. Worked like a charm. Ubuntu 10.10 64bit, Ruby 1.9.3-p0, Rails 3.1.3. RVM.

    export SRC_PATH=~/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0 
           # or something like that - note there are several folders called ruby-1.9.3-p0 in RVM, and only one of them works - the one which has 1.9.1 in the middle, and 1.9.3 on each side of it!
    gem install linecache19-0.5.13.gem -- --with-ruby-include=$SRC_PATH
    gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SRC_PATH
    gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=$SRC_PATH
    gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=$SRC_PATH

    See you at the world cup.

  24. Carilda A Thomas Carilda A ThomasJanuary 30, 2012 @ 10:09 PM

    Cannot build gem install ruby-debug-base19-0.11.26.gem – I seem to be missing ‘method.h’ – from the mkmf.log:

    conftest.c:3:20: fatal error: method.h: No such file or directory compilation terminated. checked program was: /* begin / 1: #include “ruby.h” 2: 3: #include 4: 5: /top*/

    What do I need to install to get this and do I then need to rebuild the ruby? Thanks.

  25. Fernando Briano Fernando BrianoJanuary 31, 2012 @ 08:17 PM

    Got here via StackOverflow (http://stackoverflow.com/questions/8378277/cannot-use-ruby-debug19-with-1-9-3-p0) trying to install ruby-debug on an Ubuntu box and managed to get it working.

    Great job, thanks Santiago!

  26. Lucas Chan Lucas ChanFebruary 03, 2012 @ 04:05 AM

    For rbenv users trying to install this version of the ruby-debug-base19 gem, try this:

    gem install ruby-debug-base19-0.11.26.gem——with-ruby-include=/Users/lchan/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0

  27. Ed Ruder Ed RuderFebruary 05, 2012 @ 10:02 AM

    @googya: Did you ever figure out the `LoadError: cannot load such file—ruby_debug.so` problem? I’m getting that when using bundler to load all of the gems (after vendoring linecache19-0.5.13 and ruby-debug-base19-0.11.26), then running `bundle exec rib` and `require ‘ruby-debug’` in irb.

  28. Stephen Potenza Stephen PotenzaFebruary 08, 2012 @ 11:03 PM

    Worked great! Thanks for the tips.

  29. Stephen Potenza Stephen PotenzaFebruary 08, 2012 @ 11:03 PM

    Worked great! Thanks for the tips.

  30. Stephen Potenza Stephen PotenzaFebruary 08, 2012 @ 11:03 PM

    Worked great! Thanks for the tips.

  31. Freddy Snijder Freddy SnijderFebruary 13, 2012 @ 03:18 PM

    Hi Santiago and commenters,

    Thanks for the tips, to get my debug setup working in Mac OS X Lion 10.7.2, Aptana Studio 3, using rvm and ruby 1.9.3-p0 I had to take multiple steps which I summarized at Stackoverflow:

    Ruby-debug not working – Stack Overflow

    I hope this helps other developers tearing their hair out to get their ruby debug environment setup correctly.

    Cheers,

    -- Freddy
  32. Flash The Net Flash The NetFebruary 21, 2012 @ 02:13 AM

    My brother recommended I would possibly like this website. He was once entirely right. This put up actually made my day. You can not believe simply how a lot time I had spent for this information! Thanks!

  33. Jacques JacquesFebruary 22, 2012 @ 12:58 AM

    Is there a way to package this up in the Gemfile? I was able to get it working once, but new developers who check out the project have to go through this same frustrating process.

    What if we just created a new gem name (ruby-debug193) and pushed all these to rubygems? Not ideal, but infinitely better than the current situation

Comment