Skip to content

Instantly share code, notes, and snippets.

@huynguyen
Created October 31, 2011 22:42
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@millisami
Copy link

Since rvm 1.9.2, no need to autoconf manually. See the below Running autoreconf.

And even don't have to install libyaml manually as mentioned at Install Ruby 1.9.3 with Libyaml

Make sure you've have rvm at least 1.9.2 running rvm get head

rvm install ruby-1.9.3-p0 --force --patch 56.diff                                                                    
Installing Ruby from source to: /Users/millisami/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...

ruby-1.9.3-p0 - #fetching 
ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /Users/millisami/.rvm/src/ruby-1.9.3-p0
ruby-1.9.3-p0 - #extracted to /Users/millisami/.rvm/src/ruby-1.9.3-p0
Applying patch '56.diff' (located at /Users/millisami/apps/56.diff)
Running autoreconf
Fetching yaml-0.1.4.tar.gz to /Users/millisami/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/millisami/.rvm/src
Configuring yaml in /Users/millisami/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/millisami/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/millisami/.rvm/usr
ruby-1.9.3-p0 - #configuring 
ruby-1.9.3-p0 - #compiling 
ruby-1.9.3-p0 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.9.3-p0 ...
Installation of rubygems completed successfully.
ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p0 - #importing default gemsets (/Users/millisami/.rvm/gemsets/)
Install of ruby-1.9.3-p0 - #complete 
millisami at sachin in ~/apps on develop ✹ ✭
± rvm reload                                                                                                           
RVM reloaded!
millisami at sachin in ~/apps on develop ✹ ✭
± rvm 1.9.3                                                                                                            
millisami at sachin in ~/apps on develop ✹ ✭
± gem -v                                                                                                                 
1.8.10

@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