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

468 views Asked by At

I am trying to install json ruby gem on Windows 7 32 System.

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

    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.

    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

    gem install json --platform=ruby --verbose
    

The error I am getting while installing json is bellow.

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. Kindly help me to identify whats missing and why the error coming.

2

There are 2 answers

0
Sachin Singh On

Try this out:

Why don't you download the json .gem file from rubygems.org and install it directly using command

gem install json-x.x.x.gem
1
bbozo On

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. I would edit the files with netbeans in windows and run the code in putty, the VM would basically be headless.

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. How about an online development environment such as 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.