Skip to content

Instantly share code, notes, and snippets.

@huynguyen
Created October 31, 2011 22:42
Show Gist options
  • Save huynguyen/1329273 to your computer and use it in GitHub Desktop.
Save huynguyen/1329273 to your computer and use it in GitHub Desktop.
ruby-1.9.3-p0 ruby-debug and rvm
#Need the latest version so it knows where to get ruby-1.9.3
rvm get head
curl -O https://github.com/ruby/ruby/pull/56.diff
rvm install ruby-1.9.3-p0 --patch 56.diff
cd ~/.rvm/src/ruby-1.9.3-p0
# Need to recompile because rvm doesn't force autoconf?
autoconf -f && ./configure --prefix="$HOME/.rvm/rubies/ruby-1.9.3-p0" && make -j3 && make install
@huynguyen
Copy link
Author

For me I still needed to run autoreconf because when I checked for the symbol needed it wasn't there.

Would you try the following:
$ nm ~/.rvm/rubies/ruby-1.9.3-p0/bin/ruby | grep current_thread
if it returns something like 00000001002249d0 D _ruby_current_thread then maybe I just did it wrong...

Another way to check is to simply try to fire up the debugger.
$ ruby -v -r rubygems -r ruby-debug -e 'Debugger.start and puts Debugger.current_context'

If it works for you let me know, I'll change it up so it's not an ugly two step process.

@millisami
Copy link

Nop, the first command prints nothing and the second errors out:

○ nm ~/.rvm/rubies/ruby-1.9.3-p0/bin/ruby | grep current_thread                                                                                                                                     
millisami at sachin in ~1 ↵
○ ruby -v -r rubygems -r ruby-debug -e 'Debugger.start and puts Debugger.current_context'                                                                                                           
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
/Users/millisami/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': dlopen(/Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle, 9): Symbol not found: _ruby_threadptr_data_type (LoadError)
  Referenced from: /Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
  Expected in: flat namespace
 in /Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
    from /Users/millisami/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
    from /Users/millisami/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/millisami/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
    from /Users/millisami/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from /Users/millisami/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from /Users/millisami/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
millisami at sachin in ~1 ↵

So is it not installed properly?
Why the rvm installation logs that Running autoreconf? or is it mean something else?

@huynguyen
Copy link
Author

Yea it's not installed properly, ruby-debug is bombing looking for symbols in the binary.

I ran into the same thing the first time I wrote the gist. I did a quick look through the rvm source and there is an autoconf function defined
scripts/functions/pkg, but it's not used or is called implicitly somewhere. Maybe it's not doing the -f (force) flag?

Yea so to make it work I guess you do need to run the manual process.

@mpapis
Copy link

mpapis commented Nov 18, 2011

I just have updated RVM, you should try:

rvm get head && rvm reload
rvm reinstall 1.9.3 --force-autoconf --patch debug -j 3

@huynguyen
Copy link
Author

@mpapis Worked like a charm, thank you sir!

@sj26
Copy link

sj26 commented Dec 1, 2011

There is a new version of ruby-debug which fixes 1.9.3, no recompilation needed: http://rubyforge.org/frs/?group_id=8883

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment