1

I am trying to get Rails working on a Windows system. I installed RubyInstaller and the Devkit, but I cannot seem to get the json gem to install. When I try gem install json I get:

Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

make
generating generator-i386-mingw32.def
compiling generator.c
generator.c:1:0: error: CPU you selected does not support x86-64 instruction set
generator.c:1:0: error: CPU you selected does not support x86-64 instruction set
make: *** [generator.o] Error 1


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out

It could be my Ruby versions (I have both 2.2 and 1.9), but I do not know. What is going on?

jtzero
  • 2,204
  • 2
  • 25
  • 44
James Parsons
  • 6,097
  • 12
  • 68
  • 108
  • possible duplicate of [Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)](http://stackoverflow.com/questions/13767725/unable-to-install-gem-failed-to-build-gem-native-extension-cannot-load-such) – Taryn East Jun 18 '15 at 02:09
  • Hiya, if you google the specific error message "ERROR: Failed to build gem native extension." you'll find this has been answered before. I've voted-to-close with on of the more obvious candidates for you to try. – Taryn East Jun 18 '15 at 02:10
  • I googled `generator.c:1:0: error: CPU you selected does not support x86-64 instruction set` and got nothing useful, are you sure these are the same issues? – James Parsons Jun 18 '15 at 02:30
  • Also, all the answers seem to be for Linux / Ubuntu systems – James Parsons Jun 18 '15 at 02:31
  • so add "windows" to your search query ;) you're looking at an error caused by the c-compiler installed on your system. There's generally a whole bunch of settings telling your c-compiler which system it's currently residing on so that it can compile the come to the right kind of binary. I have no idea where to find that setting on windows... you will have to google for it. I recommend that you remove the "generator.c" part of the error message - because that's specific to your situation, but not relevant to the error. also try adding "windows" and see what you get when you google. – Taryn East Jun 18 '15 at 04:01
  • add DevKit folder path in system variables. – Zain Zafar Jun 18 '15 at 13:51
  • 1
    Hey, could you post the version of the DevKit you are using? It looks like it might be a mismatched DevKit to me. – Azolo Jun 18 '15 at 21:36

1 Answers1

1

After @Azolo posted his comment, I discovered that the DevKit version I was using did not match the Ruby version I was running. The problem came to be because I needed Ruby 1.9.3 on the path for the Heroku client to function, but was trying to use 2.2 DevKit (as I typically use Ruby 2.2 for development.

James Parsons
  • 6,097
  • 12
  • 68
  • 108