ruby怎么安装配置devkit

Python012

ruby怎么安装配置devkit,第1张

如果通过上面方法安装DevKit成功率会比较高,下面这种方法不一定能成。但如果你想折腾,可以来试试下面的手动安装。

windows下安装或升级时gem经常会碰到

Please update your PATH to include build tools or download the DevKit

from 'http://rubyinstaller.org/downloads' and follow the instructions

at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

这是因为没有安装DevKit的缘故。

DevKit 是windows平台下编译和使用本地C/C++扩展包的工具。它就是用来模拟Linux平台下的make, gcc, sh来进行编译。注:这个方法目前仅支持通过RubyInstaller安装的Ruby,如果不是建议你重新安装。安装方法:双击下载的7z文件,指定解压路径,路径中不能有空格。如C:\DevKit,这个路径就是<DEVKIT_INSTALL_DIR>。

>cd <DEVKIT_INSTALL_DIR>

>ruby dk.rb init

#生成config.yml,这里会检查将要添加DevKit支持的Ruby列表,只支持通过RubyInstaller安装的Ruby

#如果这里列出的Ruby与你的要求不符,可以手动修改

>ruby dk.rb review #检查要添加DevKit支持的Ruby列表是否有误,可以略过

>ruby dk.rb install

[INFO] Updating convenience notice gem override for 'C:/Ruby192'

[INFO] Installing 'C:/Ruby192/lib/ruby/site_ruby/devkit.rb'

检查是否安装成功

>gem install rdiscount --platform=ruby

Fetching: rdiscount-1.6.8.gem (100%)

Temporarily enhancing PATH to include DevKit...

Building native extensions. This could take a while...

Successfully installed rdiscount-1.6.8

1 gem installed

Installing ri documentation for rdiscount-1.6.8...

Installing RDoc documentation for rdiscount-1.6.8...

如果能安装rdiscount成功说明安装DevKit成功。

先安装rubyinstaller,下载并解压DevKit,注意,这两个版本要对应,网页上有说明(http://rubyinstaller.org/downloads/),解压DevKit后,打开目录,运行devkitvars.bat(是不是必须的不确定)。

打开cmd,进入DevKit的解压目录

ruby dk.rb

---

Configures an MSYS/MinGW based Development Kit (DevKit) for

each of the Ruby installations on your Windows system. The

DevKit enables you to build many of the available native

RubyGems that don't yet have a binary gem.

Usage: ruby dk.rb COMMAND [options]

where COMMAND is one of:

init prepare DevKit for installation

review review DevKit install plan

install install required DevKit executables

and 'install' [options] are:

-f, --force overwrite existing helper scripts

-------------

ruby dk.rb init

---

Initialization complete! Please review and modify the auto-generated

'config.yml' file to ensure it contains the root directories to all

of the installed Rubies you want enhanced by the DevKit.

--------------------------------

ruby dk.rb install

---

Invalid configuration or no Rubies listed. Please fix 'config.yml'

and rerun 'ruby dk.rb install'

如果出现的是这个,则需要修改config.yml

加入

- C:\Ruby200-x64

---

[INFO] Updating convenience notice gem override for 'C:/Ruby200-x64'

[INFO] Installing 'C:/Ruby200-x64/lib/ruby/site_ruby/devkit.rb'

这是对的

---------------------

gem install ruby-debug-ide

---

Temporarily enhancing PATH to include DevKit...

Building native extensions. This could take a while...

Successfully installed ruby-debug-ide-0.4.17

Parsing documentation for ruby-debug-ide-0.4.17

Installing ri documentation for ruby-debug-ide-0.4.17

1 gem installed

可以使用右键点击项目工程中的该cpp文件,选择setting,在c/c++栏,选择PreCompiled headers,然后设置第一选项,选择不使用预编译头,解决这个问题。