Rails with ruby-debugger throw 'Symbol not found: _ruby_current_thread (LoadError)'

前端 未结 7 2038
旧巷少年郎
旧巷少年郎 2020-12-04 12:14

I have standard ruby-head and Rails 3.1rc4. I installed ruby-debug with following instructions from http://dirk.net/2010/04/17/ruby-debug-with-ruby-19x-and-rails-3-on-rvm/<

相关标签:
7条回答
  • 2020-12-04 12:29

    I used the gem 'debugger' which is a fork of ruby-debug(19) that works on 1.9.2 and 1.9.3 and installs easily for rvm/rbenv rubies. It makes the error disappear !

    0 讨论(0)
  • 2020-12-04 12:34

    It looks like this is a known bug in ruby-debug-base, for the moment. I have added my comment to the issue on the bug tracker. Plase consider adding your notes as well:

    http://rubyforge.org/tracker/index.php?func=detail&aid=29222&group_id=8883&atid=34290

    In the meantime, ruby 1.9 has a built-in debugger; its just very slow. Manually add this require line to your code:

    require 'debug'
    

    Also, the debugger breaks on all StandardError exceptions by default, so do this when it first starts up:

    catch off
    
    0 讨论(0)
  • 2020-12-04 12:39

    Using ruby 1.9.3, I was able to get this to work by adding the gem 'ruby-debug-base19x' (note the 'x' at the end of the name) in addition to 'ruby-debug19'.

    0 讨论(0)
  • 2020-12-04 12:41

    My system is rvm 1.18.10 and ruby 1.9.3p392 on Mac OSX 10.8.5. I first installed gem 'ruby-debug19', but for the well-known reason, the debugger did not work.

    I then ran

    local$ gem install 'debugger'
    

    as suggested by many other posts. The gem was installed successfully with the following outputs:

    local$ gem install debugger
    Fetching: debugger-ruby_core_source-1.2.3.gem (100%)
    Fetching: debugger-linecache-1.2.0.gem (100%)
    Fetching: debugger-1.6.2.gem (100%)
    Building native extensions.  This could take a while...
    Successfully installed debugger-ruby_core_source-1.2.3
    Successfully installed debugger-linecache-1.2.0
    Successfully installed debugger-1.6.2
    3 gems installed
    Installing ri documentation for debugger-ruby_core_source-1.2.3...
    Installing ri documentation for debugger-linecache-1.2.0...
    Installing ri documentation for debugger-1.6.2...
    Installing RDoc documentation for debugger-ruby_core_source-1.2.3...
    Installing RDoc documentation for debugger-linecache-1.2.0...
    Installing RDoc documentation for debugger-1.6.2...
    local$ irb
    1.9.3-p392 :002 > require 'debugger'
    => true
    

    I then ran

    local$ rails server --debug
    /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:
    in`require': dlopen(/usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle,
    9): Symbol not found: _ruby_current_thread (LoadError)
    Referenced from: /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
    Expected in: flat namespace
     in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
    ......
    

    I resolved this error by commenting out the line "gem 'ruby-debug19'" and adding a new line "gem 'debugger'" in the Gemfile, and then ran

    local$ bundle update
    

    After that, everything worked fine.

    local$ rails server --debug
    => Booting WEBrick
    => Rails 3.2.14 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    => Debugger enabled
    [2013-10-15 12:50:21] INFO  WEBrick 1.3.1
    [2013-10-15 12:50:21] INFO  ruby 1.9.3 (2013-02-22) [x86_64-darwin10.8.0]
    [2013-10-15 12:50:21] INFO  WEBrick::HTTPServer#start: pid=7206 port=3000
    
    0 讨论(0)
  • 2020-12-04 12:48

    This was fixed upgrading to the latest gems of all debug

    0 讨论(0)
  • 2020-12-04 12:49

    If you are running Ruby 1.9.3x, to fix it go to ruby-debug on rubyforge, download and install ruby-debug-base 0.11.26 and linecache19 0.5.13. Modify your Gemfile to use these files, then run

    bundle update ruby-debug-base19
    

    Debugger should work now.

    Thanks Jerome

    0 讨论(0)
提交回复
热议问题