在Windows 7 x64上安装Ruby和Rails以及DevKit的问题 - 需要修复

时间:2012-07-19 11:29:18

标签: ruby-on-rails ruby devkit

尝试安装ruby和rails时遇到了一些问题。在清除以前安装的版本后,我已经尝试了两种方法,现在已经尝试过。

当尝试运行“gem install rdiscount --platform = ruby​​”时,我收到以下错误:

C:\Windows\system32>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rdiscount:
    ERROR: Failed to build gem native extension.

    "C:/Program Files (x86)/ruby-1.9.3/bin/ruby.exe" extconf.rb
checking for random()... *** 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=C:/Program Files (x86)/ruby-1.9.3/bin/ruby
    --with-rdiscount-dir
    --without-rdiscount-dir
    --with-rdiscount-include
    --without-rdiscount-include=${rdiscount-dir}/include
    --with-rdiscount-lib
    --without-rdiscount-lib=${rdiscount-dir}/lib
C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
    from C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
    from extconf.rb:5:in `<main>'


Gem files will remain installed in C:/Program Files (x86)/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8 for inspection.
Results logged to C:/Program Files (x86)/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8/ext/gem_make.out

我按照指示运行了DevKit安装,似乎工作正常。 Rails以前工作但现在不行。有人对如何使这个工作有任何建议吗?或者是卸载的情况并重新尝试?

由于

2 个答案:

答案 0 :(得分:5)

我建议您再次卸载和安装。另外我建议使用http://railsinstaller.org/中的Rails安装程序,根据我的经验,这是在Windows机器上安装rails和ruby的最无痛方法。

答案 1 :(得分:2)

似乎你在一个带有空格的目录中安装了Ruby(沿着DevKit?)。

如Ruby自己的安装程序所示,不建议使用带空格的路径(这就是默认为C:\Ruby193

的原因

作为DevKit一部分的编译器GCC在使用空格路径方面存在问题,因此建议将DevKit的安装放置在无空格的路径中(例如C:\DevKit

所有这些都在RubyInstaller和DevKit installation instructions page

中提到