Skip to content

Instantly share code, notes, and snippets.

@boriscy
Created November 1, 2011 18:57
Show Gist options
  • Save boriscy/1331533 to your computer and use it in GitHub Desktop.
Save boriscy/1331533 to your computer and use it in GitHub Desktop.
ruby-debug in ruby-1.9.3 and ubuntu
#To install ruby-debug on Ubuntu ruby-1.9.3 you 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 in your console
export RVM_SRC=/your/path/to/ruby-1.9.3
# Note, your source path should be something like /home/user/.rvm/src/ruby-1.9.3-p0
gem install archive-tar-minitar
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=/$RVM_SRC
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=/$RVM_SRC
@statique
Copy link

statique commented Nov 8, 2011

Thank you!

@jescalante
Copy link

I've installed the gems in order, but when I try to install ruby-debug-base I get this:

$ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug-base19-0.11.26.gem:
ERROR: Failed to build gem native extension.

    /home/joe/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb --with-ruby-include=//home/joe/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/joe/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
--with-ruby-dir
--without-ruby-dir
--with-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
extconf.rb:16:in block in <main>': break from proc-closure (LocalJumpError) from /home/joe/.rvm/gems/ruby-1.9.3-p0/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:18:incall'
from /home/joe/.rvm/gems/ruby-1.9.3-p0/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:18:in create_makefile_with_core' from extconf.rb:32:in

'

Gem files will remain installed in /home/joe/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.26 for inspection.
Results logged to /home/joe/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.26/ext/ruby_debug/gem_make.out

@jescalante
Copy link

any hints?

@focusaurus
Copy link

I have the same error as @jescalante

@hoverlover
Copy link

@jescalante, you need to use the include path, not the bin path. For me, this is /Users/cboyd/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0, but I'm using rbenv, not rvm. You will need to find it under your rvm ruby install path.

@boriscy
Copy link
Author

boriscy commented Nov 23, 2011

jescalante I think you made the wrong path to your ruby source, don't point it to bin point it to the sources, in your case my guess is

export RVM_SRC=/home/joe/.rvm/src/ruby-1.9.3-p0

@jescalante
Copy link

@hoverlover @boriscy Thanks! That was it! However, while I can include 'ruby-debug' in irb shell, I can't include it in my rails app. In my Gemfile I added:

gem 'ruby_core_source', '0.1.5', :path => "/.rvm/gems/ruby-1.9.3-p0/gems/ruby_core_source-0.1.5/"
gem 'linecache19', '0.5.13', :path => "
/.rvm/gems/ruby-1.9.3-p0/gems/linecache19-.5.13/"
gem 'ruby-debug-base19', '0.11.26', :path => "/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.26/"
gem 'ruby-debug19', '0.11.6', :path => "
/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug19-0.11.6/"

I assumed that this is the way of telling rails it has to use this gems locally. Searching in the strace that irb makes when I required ruby-debug I found out that it finds it here:

open("/home/joe/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb", O_RDONLY) = 5

As you can see, it founds it in 'cli'. I did the same with the rails console, but grepping the result I found that it not looks in 'cli' for 'ruby-debug'. I'm clueless here...

@hoverlover
Copy link

These are the lines from my Gemfile:

gem "linecache19", "0.5.13"
gem "ruby-debug-base19", "0.11.26"
gem "ruby-debug19", require: 'ruby-debug'

@boriscy
Copy link
Author

boriscy commented Nov 23, 2011

@jescalante I think you are in another rvm gemset, please check this, You have to install this gems on the correct gemset, for example you are usign rails 3.1

 rvm ruby-1.9.3-p0
 rvm gemset create rails3.1
 rvm gemset use rails3.1
 export RVM_SRC=/your/path/to/ruby-1.9.3

Note, your source path should be something like /home/user/.rvm/src/ruby-1.9.3-p0

gem install archive-tar-minitar
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=/$RVM_SRC
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=/$RVM_SRC

And you better have in your app a .rvmrc file with:

 rvm [email protected]

@jescalante
Copy link

@hoverlover Now it works! thank you, I don't know why I thought that I had to set a local path for the recent gems :-S @boriscy I'm not using gemsets yet, but I should, thank you for the suggestion and for the gist btw. Greetings!

@andrewroth
Copy link

I had to do:

rvm install ruby-1.9.3-p0
export RVM_SRC=$HOME/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1
gem install archive-tar-minitar
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=/$RVM_SRC
export RVM_SRC=$HOME/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC

Edit Gemfile:

  gem 'linecache19', '0.5.13', :path => "~/.rvm/gems/ruby-1.9.3-p0/gems/linecache19-0.5.13/"
  gem 'ruby-debug-base19', '0.11.26', :path => "~/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.26/"
  gem 'ruby-debug19', :require => 'ruby-debug'

Then

gem install bundler
bundle install --system

@superplussed
Copy link

Ty andrewroth!

@caryfitzhugh
Copy link

Hey all - for what it is worth, (this may or may not work for you) -- I put those things on my company's github page, and just added these lines to my gemfile. It's a lot easier to push this to all the guys on the team, when it's just a gemfile update. Hope it possibly helps.

gem "ruby-core-source19", :git => "git://github.com/Ziplist/ruby_core_source19.git", :require => "ruby-core-source"
gem "ruby-debug-base19",  :git => "git://github.com/Ziplist/ruby_debug_base19.git", :require=>"ruby-debug-base"
gem 'ruby-debug19'     ,  :git => "git://github.com/Ziplist/ruby_debug19.git",              :require=>"ruby-debug"
gem 'linecache19'      ,  :git => "git://github.com/Ziplist/linecache19.git",                  :require =>"linecache"

@caryfitzhugh
Copy link

So - I post it and now bundle install again, and have some issues... will post when I figure them out.

@bosborne
Copy link

bosborne commented Jan 8, 2012

Worked for me, and I'm not using rvm:

gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=/usr/local/include/ruby-1.9.1ruby-1.9.3-p0/
Successfully installed ruby-debug19-0.11.6
1 gem installed
Installing ri documentation for ruby-debug19-0.11.6...

@jaredmdobson
Copy link

Thank you so much I just some extra folders and the rest worked.
export RVM_SRC=/home/jaredmdobson/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0

@fawce
Copy link

fawce commented Feb 3, 2012

wow, thank you so much. check out my fork if you have a chance!

@jonleung
Copy link

jonleung commented Feb 3, 2012

For anyone else that has problems with this, checkout @andrewroth 's post, that worked for me!

Why is this still not fixed yet?!?!

@tomafc330
Copy link

great that worked. yes they should really fix it

@xnzac
Copy link

xnzac commented Mar 30, 2012

+1 for @andrewroth's method!

@jeremyw
Copy link

jeremyw commented Apr 4, 2012

@postmodern
Copy link

Couldn't you also use Ruby 1.9's built-in debugger?

require 'debug'

Or via the command-line:

$ ruby -rdebug test.rb

Also, the debugger fork of ruby-debug19 should work, if you absolutely need to stick with ruby-debug.

@boriscy
Copy link
Author

boriscy commented Apr 6, 2012

Thanx @jeremyw and @postmodern, I'm using debugger now.

@davidneimeyer
Copy link

On my super vanilla CentOS 6.3:

gem install ruby_core_source
gem install linecache
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/usr/local/include/ruby-1.9.1/ruby-1.9.3-p0/

@bharadwaj6
Copy link

couldn't have worked without @andrewroth's help. Ty dude!

@ytrezq
Copy link

ytrezq commented Aug 23, 2015

@boriscy now that rubyforge has been definitely shut down, where to download ruby-debug-base19-0.11.26.gem?

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