Receive: "ERROR: Failed to build gem native extension" when trying to install rails gem on ruby 1.9.2 using pik

StackOverflow https://stackoverflow.com/questions/14656098

Question

I was trying to push my local database to Heroku and received this error:

...Taps Server Error: PGError: ERROR: time zone displacement out of range:...

Some googling later I discovered that this error doesn't occur with ruby 1.9.2 and that (because being on windows) I'd have to install pik to run 1.9.2 alongside 1.9.3. So I installed pik and ruby 1.9.2.

However, when I try to install rails on 1.9.2 I get this error:

...ERROR: Failed to build gem native extension...

After plenty of googling I've ran into the following:

  • Don't bother using windows for ruby/rails development :(
  • Something to do with devkit?
  • Or installing a binary kit version of rails?
  • Compile it yourself

Any help is much appreciated!

EDIT:

Full error stack trace:

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

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

make
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/backward -
I/C/Ruby192/include/ruby-1.9.1 -I. -DJSON_GENERATOR    -O3 -g -Wextra -Wno-unused-parameter -Wno-par
entheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -O3 -Wall -O
0 -ggdb  -o generator.o -c generator.c
make: gcc: Command not found
make: *** [generator.o] Error 127


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.7.6 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
Était-ce utile?

La solution

The relevant part of the error message is gcc: Command not found; so the compiler is not available to compile the code locally.

If you already have gcc installed on your machine somewhere, make sure it is included in the PATH.

Check the How to install gcc on windows 7 machine? for guidance on how to install gcc on windows.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top