ruby-debug19 on ruby-1.9.3-preview1 [duplicate]
Asked Answered
L

6

8

Possible Duplicate:
Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with “Symbol not found: _ruby_threadptr_data_type”

I'm having some problems getting debugging working on the ruby 1.9.3 preview1 release.

I've installed the 1.9.3 using rvm with the following command:

rvm install 1.9.3 --reconfigure --debug -C --enable-pthread

And installed ruby-debug19 with this:

gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-preview1

The debug gem installs fine but when I go to open a console with debugging or try anything with a debug flag rails c --debug or rspec spec --debug. I get the following error:

/Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle, 9): Symbol not found: _ruby_current_thread (LoadError)
  Referenced from: /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
  Expected in: flat namespace
 in /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `each'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `each'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@global/gems/bundler-1.0.17/lib/bundler.rb:120:in `require'
    from /Users/mario/Work/project/config/application.rb:7:in `<top (required)>'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/railties-3.0.9/lib/rails/commands.rb:21:in `require'
    from /Users/mario/.rvm/gems/ruby-1.9.3-preview1@project/gems/railties-3.0.9/lib/rails/commands.rb:21:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Liebfraumilch answered 14/8, 2011 at 4:7 Comment(3)
You are walking on the bleeding edge, between Lion and 1.9.3-preview. You might want to contact the author/supporters for ruby-debug directly.Aida
Yeah I realise, I thought i'd ask the question to see if anyone had a solution already or if there's something i've missed. I'll log a ticket if no one comes up with anything.Liebfraumilch
see #6438616Remark
L
13

Here's an alternate solution I found in a Gist by rafaeldx7.

Basically, the solution is to use newer versions of a couple of libraries, linecache19 v0.5.13 & ruby-debug-base19 v0.11.26, neither of which is in the RubyGem repo yet.

# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

echo "Installing ruby-debug with ruby-1.9.3-p0 ..."

curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem

gem install linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p0/

rm linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem

echo "Done."
Lavernelaverock answered 4/11, 2011 at 1:5 Comment(2)
Don't miss the simple install hiding in the comment: bash < <(curl -L https://raw.github.com/gist/1333785)Draconian
or, for rbenv users who don’t have the ruby source lying around (substitue your ruby version number): gem install linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem -- --with-ruby-include=~/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby-1.9.3-p125Biak
I
7

EDIT: The git-pinning solution worked at first, but I haven't been able to use it consistently. I'll leave it here because people have upvoted it, but I think my ruby-debug CLI worked by chance since it's packaged in an unconventional way.

I'd recommend using pry instead; it seems to be ruby-debug and more. Also, I've used require 'debug' for a while too, mentioned at the top of the answer (and possibly what people were upvoting) and the scope it drops you in is usually not what you expect. Again, use pry (and note that if you want debugger-like stepping, you also need this pry plugin, which I haven't yet needed/tested).


Saw Rails with ruby-debugger throw 'Symbol not found: _ruby_current_thread (LoadError)' (summary: you can use 1.9s built in debugger for now) just after I figured out the following:

Since I notice you're trying to get it to work with Rails, in case you're using bundler, you can add this to your gemfile:

gem 'linecache19', :git => 'https://github.com/mark-moseley/linecache.git' 
gem 'ruby-debug-base19', :git => 'https://github.com/mark-moseley/ruby-debug.git'

then execute:

bundle config build.ruby-debug-base19 --with-ruby-include="$rvm_path/src/$(rvm tools strings)/"
bundle install
Intuitional answered 13/11, 2011 at 4:12 Comment(2)
Even with this, I still get cannot load such file -- ruby-debug, even if i say :require => 'ruby-debug'Kibbutznik
Yeah, I must have had something set up just right. I can't repro it on another project. The issue is that ruby-debug-base19's 'package' task makes two gems, one for base, and one for the CLI interpreter. It looks like these used to be two projects, but were merged? Not sure why, but it makes it hard to use like this. Anyways, updated my solution to advise 'pry'Intuitional
N
3

I've created a Rubygems repo with the newest version for 1.9.3.

Just add this source line on your Gemfile, and it's all set:

source 'http://rubydebug19.s3.amazonaws.com'

gem 'ruby-debug19', :group => :development
Namedropper answered 30/1, 2012 at 19:15 Comment(1)
Well done! I'm so tired of relearning how to deal with this issue on each project!Tinnitus
N
0

Here's a temporary solution: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

Excerpt from the site:

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
Nicolis answered 2/11, 2011 at 3:34 Comment(1)
answers with only links aren't useful if the link goes away in the future. Can you summarize or paraphrase what it says there?Abseil
M
0

Here's what I did to get things working with Bundler 1.x and Ruby 1.9.3-p0 (the released, stable version). Hopefully this will become obsolete soon, but in the mean time it is a viable workaround if this is what you need.

First, install the linecache and ruby-debug-base gems as system gems. Note that I got these from different places.

$ curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
$ gem install linecache19-0.5.13.gem
$ gem install --pre ruby-debug-base19x # installs ruby-debug-base19x-0.11.30.pre4

Next, re-create the gem source for each installed gem:

$ mkdir ~/src/linecache19
$ cd /r193 # where your 1.9.3 is installed; system dependent
$ cd lib/ruby/gems/1.9.1 # where your gems are, should be the same
$ cp specifications/linecache19.gemspec ~src/linecache19
$ cp -r gems/linecache19-0.5.13/* ~/src/linecache19

$ mkdir ~/src/ruby-debug-base19x
$ cp specifications/ruby-debug-base19x-0.11.30.pre4.gemspec ~/src/ruby-debug-base19x
$ cp -r ruby-debug-base19x-0.11.30.pre4/* ~/src/ruby-debug-base19x

Now you can refer to these directories in your Gemfile using the :path directive. If you have a local git repository, you can add commit those directories there and refer to them from your Gemfile, something like this:

group :development do
  gem 'linecache19', '~>0.5.12', :git => 'git://git-repo/ruby/linecache19.git'
  gem 'ruby-debug-base19x', :git => 'git://git-repo/ruby/ruby-debug-base19x.git'
  gem 'ruby-debug19', :require => 'ruby-debug'
  gem 'ruby-prof'
end
Misogynist answered 19/12, 2011 at 17:22 Comment(0)
S
0

most of these answers have gone stale since 1.9.3-p125.

I've written up new instructions here for ubuntu 11.10: https://gist.github.com/2218661

Starlin answered 27/3, 2012 at 18:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.