因为之前是用InstantRails-2.0-win来安装的,然后下载ruby1.92,将ruby1.92的安装包覆盖在InstantRails-2.0-win的子目录ruby下,原本这里是ruby1.87版。后来想要debug的时候,需要首先安装DevKit(DevKit 是windows平台下编译和使用本地C/C++扩展包的工具。它就是用来模拟Linux平台下的make, gcc, sh来进行编译)。下载好DevKit后,指定解压路径,路径中不能有空格。如C:\DevKit。
> cd <DEVKIT_INSTALL_DIR> 2 > ruby dk.rb init 3 #生成config.yml,这里会检查将要添加DevKit支持的Ruby列表,只支持通过RubyInstaller安装的Ruby 4 #如果这里列出的Ruby与你的要求不符,可以手动修改 5 > ruby dk.rb review #检查要添加DevKit支持的Ruby列表是否有误,可以略过 6 > ruby dk.rb install 7 [INFO] Updating convenience notice gem override for 'C:/Ruby192' 8 [INFO] Installing 'C:/Ruby192/lib/ruby/site_ruby/devkit.rb'
注:
在生成config.yml后,我将它指定的C:/Ruby192 修改成 D:/InstantRails-2.0-win/ruby 。然后再 ruby dk.rb install。
检查是否安装成功
> gem install rdiscount --platform=ruby 2 Fetching: rdiscount-1.6.8.gem (100%) 3 Temporarily enhancing PATH to include DevKit... 4 Building native extensions. This could take a while... 5 Successfully installed rdiscount-1.6.8 6 1 gem installed 7 Installing ri documentation for rdiscount-1.6.8... 8 Installing RDoc documentation for rdiscount-1.6.8...
如果能安装rdiscount成功说明安装DevKit成功。
然后
gem install ruby-debug19
总是报错,类似于下面(因这是隔天写的,头天的一些报错信息并没有保存,在网上找了个类似的):
E:/programs/Ruby19/bin/ruby.exe extconf.rb checking for vm_core.h... no checking for vm_core.h... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=E:/programs/Ruby19/bin/ruby --with-ruby-dir --without-ruby-dir --with-ruby-include --without-ruby-include=${ruby-dir}/include --with-ruby-lib --without-ruby-lib=${ruby-dir}/lib E:/programs/Ruby19/lib/ruby/1.9.1/net/http.rb:581:in `initialize': Connection failed. - connect(2) (Errno::ETIMEDOUT) from E:/programs/Ruby19/lib/ruby/1.9.1/net/http.rb:581:in `open' from E:/programs/Ruby19/lib/ruby/1.9.1/net/http.rb:581:in `block in connect' from E:/programs/Ruby19/lib/ruby/1.9.1/timeout.rb:44:in `timeout' from E:/programs/Ruby19/lib/ruby/1.9.1/timeout.rb:82:in `timeout' from E:/programs/Ruby19/lib/ruby/1.9.1/net/http.rb:581:in `connect' from E:/programs/Ruby19/lib/ruby/1.9.1/net/http.rb:574:in `do_start' from E:/programs/Ruby19/lib/ruby/1.9.1/net/http.rb:563:in `start' from E:/programs/Ruby19/lib/ruby/1.9.1/net/http.rb:1094:in `request' from E:/programs/Ruby19/lib/ruby/gems/1.9.1/gems/ ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:239:in `block in read' from E:/programs/Ruby19/lib/ruby/gems/1.9.1/gems/ ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:286:in `connect' from E:/programs/Ruby19/lib/ruby/gems/1.9.1/gems/ ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:234:in `read' from E:/programs/Ruby19/lib/ruby/gems/1.9.1/gems/ ruby_core_source-0.1.4/lib/contrib/uri_ext.rb:128:in `download' from E:/programs/Ruby19/lib/ruby/gems/1.9.1/gems/ ruby_core_source-0.1.4/lib/ruby_core_source.rb:55:in `block in create_makefile_ with_core' from E:/programs/Ruby19/lib/ruby/1.9.1/tempfile.rb:199:in `open' from E:/programs/Ruby19/lib/ruby/gems/1.9.1/gems/ ruby_core_source-0.1.4/lib/ruby_core_source.rb:51:in `create_makefile_with_core ' from extconf.rb:20:in `<main>' Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p378.tar.gz Gem files will remain installed in E:/programs/Ruby19/lib/ruby/gems/ 1.9.1/gems/linecache19-0.5.11 for inspection. Results logged to E:/programs/Ruby19/lib/ruby/gems/1.9.1/gems/ linecache19-0.5.11/ext/trace_nums/gem_make.out
这个错快把我搞死了,结果回过头发现,原来是没有下载ruby1.92的源码。
ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
解压到D:\InstantRails-2.0-win\ruby\src下即可。
设置环境变量PATH:D:\InstantRails-2.0-win\ruby\bin
确认Gemfile中:gem 'ruby-debug19', :require => 'ruby-debug'
最后 gem install ruby-debug19 -- --with-ruby-include=D:/InstantRails-2.0-win/ruby/src/ruby-1.9.2-p0
ok!!!!!
最后 gem install ruby-debug-ide19
ok!!!!!