Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11601 (closed defect: invalid)

Opened 1 year ago

Last modified 5 months ago

Ruby-debug Setup Problem: LoadError: no such file to load

Reported by: cagdas.gerede Assigned to: core
Priority: normal Milestone: 2.x
Component: Plugins Version: edge
Severity: normal Keywords: ruby-debug linecache
Cc:

Description

I was having this problem in Windows XP machine. I am using Rails 2.0.2 and this is happening with ruby-debug 0.10.1.

When I do

require 'ruby-debug' in my development.rb of my rails application

and when I try to start the server

ruby script/server --debugger -e development -p 80

I get the following message and the server exits:

You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'

When I try to do require 'ruby-debug' from irb: I get the following message:

LoadError: no such file to load -- c:/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/../ext/trace_nums

from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from c:/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/tracelines.rb:8 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from c:/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/linecache.rb:63 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.1-x86-mswin32/lib/ruby-debug-base.rb:3 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug.rb:5 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'

The fix that worked for me is the following:

In the file ruby\lib\ruby\gems\1.8\gems\linecache-0.42-x86-mswin32\lib\tracelines.rb

I changed the line from

require File.join(@@SRC_DIR, '..', 'ext', 'trace_nums')

to

require File.join(@@SRC_DIR, '..', 'ext', 'extconf.rb')

Then, the debugger started working as expected.

Change History

(in reply to: ↑ description ) 04/26/08 01:04:25 changed by BMorearty

I get the same error when using Rails 2.0.2 and ruby-debug 0.10.1 on Windows XP. I got the error when I ran script/server with no parameters.

Replying to cagdas.gerede:

LoadError: no such file to load -- c:/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/../ext/trace_nums

05/30/08 21:07:13 changed by mmucklo

The fix mentioned in the first post doesn't quite work, and seems to cause the following problem when trying to set a breakpoint within another file when in the debugger:

INTERNAL ERROR!!! undefined method `lnums_for_str' for TraceLineNumbers:Module

C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/tracelines.rb:22:in lnums_for_str_array' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/linecache.rb:279:in trace_line_numbers' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug/commands/breakpoints.rb:73:in execute' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug/processor.rb:272:in one_cmd' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug/processor.rb:259:in process_commands' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug/processor.rb:258:in each' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug/processor.rb:258:in process_commands' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug/processor.rb:251:in catch' C:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug/processor.rb:251:in `process_commands'

...etc.

06/03/08 20:20:29 changed by l3x

Remove the following from the end of config/environments/development.rb:

require 'ruby-debug'

The error will go away, but so will your ability to call the debugger.

06/09/08 14:01:46 changed by ryansv

  • keywords changed from ruby-debug to ruby-debug linecache.

I'm running into the same problem, same environment. Obviously removing the ruby-debug gem would make this problem go away, but I would really like to be able to use it.

01/29/09 11:45:57 changed by mhw

  • status changed from new to closed.
  • resolution set to invalid.

Alternatively, you could just update the version of linecache you're using to 0.43 (type 'gem update linecache'). According to http://rubyforge.org/forum/forum.php?forum_id=25148 the update fixes a Windows installation problem that ruby-debug was obviously hitting.

Resolving as invalid as it's not a Rails bug.

02/02/09 16:56:36 changed by BMorearty

Thanks for the pointer, mhw.

0.42 was the newest version of linecache when this bug was posted, and for 3 months thereafter, so upgrading to 0.43 was not an option at the time. 0.43 became available on 6-12-08, and hooray for the fix!