在netbeans6.8(使用ruby1.8.6)的一个rails项目上右键点击"调试",提示
未安装版本与0\.4\..*模式匹配的ruby-debug-ide 点击"安装快速调试器",出现如下的错误:
------------------------------------------------------
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug-ide:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe mkrf_conf.rb
Building native extensions. This could take a while...
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9/ext/gem_make.out
------------------------------------------------------
然后在C:\ruby\lib\ruby\gems\1.8\gems下发现了刚刚生成的ruby-debug-ide-0.4.9目录和ruby-debug-base-0.10.3目录。
接着在cmd里gem install ruby-debug,也报错:
------------------------------
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb
creating Makefile
nmake
'nmake' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-bas
e-0.10.3 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/ext/gem_
make.out
-------------------------------
然后发现ruby-debug-base-0.10.3目录重新生成了。
现在说一下解决步骤:
1,下载http://rubyforge.iasi.roedu.net/gems/ruby-debug-base-0.9.3-mswin32.gem
gem install ruby-debug-base-0.9.3-mswin32.gem2, 去http://rubyforge.org/projects/debug-commons/下载ruby-debug-ide-0.4.6.gem
gem install ruby-debug-ide-0.4.6.gem 版本不能高于0.4.6,如果高了都报
ERROR: Failed to build gem native extension.
0.4.7见ruby-debug-ide-0.4.7\ext\extconf.rb
0.4.9见ruby-debug-ide-0.4.9\ext\mkrf_conf.rb
0.4.6压根就没有ext目录
有人说要装什么linecache.gem,我没安装。
还有人装了ruby-debug.gem,我也没安装。
在http://rubyforge.mirrors.roedu.net/gems里能找到老版本。
感谢http://hlee.javaeye.com/blog/576237
在netbeans里调试时发现有问题,那个绿三角不能点多了,否则会影响后面的调试。
另外不明白gem除了把文件拷到gems目录下,还做了什么。
后面都是记录,仅供参考。
在
How to enable Ruby debug in RubyMine 2.0 on Windows里说
(If you installed Ruby with the zip binary, reinstall it using the one-click installer as found here. That's because currently the ruby debugger ide only works on Windows using a RubyInstaller installation). Also verify that Ruby's root path doesn't include spaces.- ...略
- ...略
- ...略
- Open with a text editor the file command.rb that's part of the installed ruby-debug-ide19 gem. In my case, that file was under folder C:\Programmi\Ruby19\lib\ruby\gems\1.9.1\gems\ruby-debug-ide19-0.4.12\lib\ruby-debug
- Modify the beginning of procedure debug_eval (at line 120) so to enter a new statement between statements str = str.to_s and max_time = 10. The new statement to enter is:
return "" if str == "$FILENAME"
At the end, the procedure debug_eval should begin like this:
def debug_eval(str, b = get_binding)
begin str = str.to_s
return "" if str == "$FILENAME"
max_time = 10
to_inspect = str.gsub(/\\n/, "\n")
ruby-debug to Ruby 1.9
如果使用的是ruby1.9,则
Installation: IDE version和
NetBeans 6.7.1 IDE updates.ruby-debug19 only works on Windows using a RubyInstaller installation,Do not install to a path that has a space inside of it.In both cases, you will also need to download and install the
DevKit.
原来在
ruby-debug-ide 0.4.7 的release notes里说了原因:
Patch by Mark Moseley supporting ruby-debug-base19.
Dynamically installs right ruby-debug-base dependency depending on the
version of a Ruby platform being used. ruby-debug-base19 is the only solution
these days for 1.9 debugging, so might be temporary solution until ruby-debug
projects brings official version.
另外参见
Ruby 2.0 Beta Issue: Error installing ruby-debug-ide19 Debug supported for ruby 1.8.7?在
从下午弄到深夜还没解决关于ruby-debug-ide的问题发现有人解决了:
我试了下ruby1.8.6还是不行,还是报那个异常。没法换成NetBeans6.8集成的jruby,集成的jruby中自带ruby-debug-ide,OK了。在这里提示一下,不要选jruby.exe要选jruby.bat,希望对遇到同样问题的人有所帮助。
问题解决,解决步骤:1.下载rubyinstaller,安装;2.下载devkit,解压到根目录后,修改 “ruby路径”\devkit\msys\1.0.11\etc\fstab为
“ruby路径”/devkit/gcc/3.4.5/mingw32
“ruby路径”/devkit/msys/1.0.11/usr/local /usr/local
然后在命令行窗口,gem install linecache19 这个要好长时间,耐心等待。然后gem install ruby-debug-ide19,这个就快了。这就OK了,不要在rubymine中安装ruby-debug-ide19和linecache19,会报错。
某人的
解决办法:
在RubyMine里调试提示需要安装ruby-debug-ide,但是安装的过程有问题,提示:
ERROR: Failed to build gem native extension.
于是想解开gem包,把里面的extension去掉。但是编辑完之后再用winrar打包gem就认不出来了。看来压缩的格式也很重要。于是找来了tar和gzip两个工具,tar还好,用gzip解压和压缩过的文件还是认不出来。只有另想别的办法了。突然想到把文件解压之后,应该可以用gem的工具来生成一个gem安装文件吧。于是找了一篇制作gem的教程,把extension去掉之后制作了一个gem,居然可以顺序安装了。然后重新打开 RubyMine也可以调试了。
Trying to install ruby-debug-ide on jruby 1.2.0http://youtrack.jetbrains.net/issue/RUBY-5341好帖
Ruby调试器一览一个
视频http://netbeans.org/kb/60/ruby/debugger-screencast.html
201010补充:
根本没有那么复杂,
装DevKit,把DevKit\bin设置为环境变量,然后就可以在netbean中安装和执行了