在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中安裝和執行了