简体   繁体   English

错误:无法构建gem本机扩展Windows 7 32位

[英]ERROR: Failed to build gem native extension Windows 7 32 Bit

I am trying to install json ruby gem on Windows 7 32 System. 我正在尝试在Windows 7 32 System上安装json ruby gem。

The local environment details are 当地环境详细信息是

D:\Environment\DevKit32Ruby200>gem -v
2.0.14

D:\Environment\DevKit32Ruby200>ruby -v
ruby 2.0.0p451 (2014-02-24) [i386-mingw32]

D:\Environment\DevKit32Ruby200>rails -v
Rails 4.0.4

I have already tried following things 我已经尝试了以下操作

  1. Downgrading system ruby gems version to 2.3.0 using 使用以下命令将系统ruby gems版本降级到2.3.0

     gem update --system 2.3.0 
  2. I have done proper setting of devkit and manually I added proper ruby directory path in config.yml file. 我已经正确设置了devkit,并手动在config.yml文件中添加了正确的ruby目录路径。

     D:\\Environment\\DevKit32Ruby200>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. D:\\Environment\\DevKit32Ruby200>ruby dk.rb install --force [WARN] Updating (with backup) existing gem override for 'D:/Environment/ruby200new' [WARN] Updating (with backup) DevKit helper library for 'D:/Environment/ruby200new' 
  3. I have also tried putting platform=ruby 我也尝试过将platform = ruby​​放进去

     gem install json --platform=ruby --verbose 

The error I am getting while installing json is bellow. 我在安装json时遇到的错误如下。

D:\Environment\DevKit32Ruby200>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    D:/Environment/ruby200new/bin/ruby.exe extconf.rb
creating Makefile

make "DESTDIR="
generating generator-i386-mingw32.def
compiling generator.c
linking shared-object json/ext/generator.so

make "DESTDIR=" install
/usr/bin/install -c -m 0755 generator.so ./.gem.20170109-8336-qvgvzc/json/ext
make: execvp: /usr/bin/install: Permission denied
make: *** [install-so] Error 127


Gem files will remain installed in D:/Environment/ruby200new/lib/ruby/gems/2.0.0/gems/json-2.0.2 for inspection.
Results logged to D:/Environment/ruby200new/lib/ruby/gems/2.0.0/gems/json-2.0.2/ext/json/ext/generator/gem_make.out

There are 10's of questions are already tagged on this issue but none resolved. 此问题上已经有10个问题的标签,但没有解决。 Kindly help me to identify whats missing and why the error coming. 请帮助我确定缺少的内容以及错误原因。

i386-mingw32 is a mountain of pain that'll never be fully supported, when I spent time on Windows I used to use a VirtualBox VM with ubuntu installed which shares a folder with the Windows host. i386-mingw32痛苦i386-mingw32 ,当我花时间在Windows上时,我曾经使用安装了ubuntu的VirtualBox VM来与Windows主机共享一个文件夹。 I would edit the files with netbeans in windows and run the code in putty, the VM would basically be headless. 我会在Windows中使用netbeans编辑文件,然后在腻子中运行代码,VM基本上没有头了。

I actually did a lot of real work that way. 我实际上以这种方式做了很多实际工作。 If you want to do a "Hello World" rails app - OK - good luck even with that. 如果您想做一个“ Hello World” rails应用程序-好的-即使这样,也祝您好运。 How about an online development environment such as https://c9.io/ ? 诸如https://c9.io/的在线开发环境如何?

But if you want to work , not just play around, set yourself up with an Ubuntu VM at the very least, or work in Ubuntu/MacOS at the very best. 但是,如果您想工作 ,而不仅仅是玩耍,请至少使用Ubuntu VM进行设置,或者最好使用Ubuntu / MacOS。

Try this out: 试试看:

Why don't you download the json .gem file from rubygems.org and install it directly using command 为什么不从rubygems.org下载json .gem文件并直接使用命令安装

gem install json-x.x.x.gem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM