在 Windows 7 x64 上安装 Ruby 和 Rails 以及 DevKit 时出现问题 - 需要修复 [英] Issues installing Ruby and Rails and DevKit on windows 7 x64 - fix needed

查看:50
本文介绍了在 Windows 7 x64 上安装 Ruby 和 Rails 以及 DevKit 时出现问题 - 需要修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试安装 ruby​​ 和 rails 时遇到了许多问题.清除以前安装的版本后,我已经尝试了没有和现在.

尝试运行gem install rdiscount --platform=ruby"时出现以下错误:

C:\Windows\system32>gem install rdiscount --platform=ruby暂时增强 PATH 以包含 DevKit...构建原生扩展.这可能需要一段时间...错误:安装 rdiscount 时出错:错误:无法构建 gem 本机扩展."C:/Program Files (x86)/ruby-1.9.3/bin/ruby.exe" extconf.rb检查随机()... *** extconf.rb 失败 ***由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件.检查 mkmf.log 文件以获取更多详细信息.您可能需要配置选项.提供的配置选项:--with-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}/libC:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:368:in `try_do':编译器无法生成可执行文件.(运行时错误)您必须先安装开发工具.来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:693:in `block in checks_for'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in delay'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `block in delay'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'来自 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'来自 extconf.rb:5:in `<main>'Gem 文件将保留安装在 C:/Program Files (x86)/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8 中以供检查.结果记录到 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 以前可以工作,但现在不行.有人对如何使这项工作有任何建议吗?还是卸载重试的情况?

谢谢

保罗

解决方案

您似乎将 Ruby(与 DevKit 一起?)安装在一个带有空格的目录中.

正如Ruby自己的安装程序中所指出的,不推荐带空格的路径(这就是为什么默认为C:\Ruby193

DevKit 的编译器 GCC 的路径有空格有问题,所以 DevKit 的安装也建议放在没有空格的路径(例如 C:\DevKit)

RubyInstaller 和 DevKit 安装说明页面中都提到了所有这些>

I am having a number of issues when trying to install ruby and rails. I have tried both without and now after clearing the previous installed versions.

When trying to run "gem install rdiscount --platform=ruby" I get the following error:

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

I have run the DevKit installation as indicated and it seems to work. Rails was previously working but now is not. Anybody have any suggestions on how to get this working? Or is it a case of uninstall and try over again?

Thanks

Paul

解决方案

Seems you installed Ruby (along the DevKit?) inside a directory with spaces.

As indicated during Ruby own installer, path with spaces are not recommended (that is why default is C:\Ruby193

GCC, the compiler that is part of DevKit, has problems with path with spaces, so installation of DevKit is also recommended to be placed in a path without spaces (e.g. C:\DevKit)

All this is mentioned in both RubyInstaller and DevKit installation instructions page

这篇关于在 Windows 7 x64 上安装 Ruby 和 Rails 以及 DevKit 时出现问题 - 需要修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆