安装带有本机扩展错误的json(1.5.1)

时间:2011-05-09 01:40:37

标签: ruby-on-rails

我想知道为什么我会收到此错误,据我所知,我的Devkit很好,所有其他宝石在捆绑安装和更新后正确安装,除了JSON gem。有什么问题?

错误的显示方式如下:

Installing json (1.5.1) with native extensions c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/in
staller.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

c:/Ruby192/bin/ruby.exe extconf.rb
checking for ruby/re.h... *** 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:/Ruby192/bin/ruby
c:/Ruby192/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:/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
            from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
            from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
            from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
            from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
            from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'

谢谢!

2 个答案:

答案 0 :(得分:2)

感谢Joe Cannatti,他帮我解决了这个问题。 我刚刚重新安装了Devkit 并覆盖了所有文件,即使它是相同的版本(DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe),一定在第一次提取时遇到问题积分。这也修复了这个蹩脚的“程序无法启动因为你的计算机缺少msvcrt-ruby18.dll”错误。 祝别人好运!

答案 1 :(得分:0)

我必须使用RVM删除ruby,rvm remove 1.9.2,然后重新安装1.9.2,现在安装带有原生扩展的gem正在运行。注意:我还确保安装了命令行工具。

来源:https://github.com/flori/json/issues/78#issuecomment-1499920