0

I'm trying to learn Ruby on Rails with a online tutorial.

[rails version]: Rails 3.2.13
[ruby version] : ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]

When I execute the command:

rails new first_app

I get:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb 
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h


Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.

Sure enough, I ran gem install json -v '1.7.7 as listed, however the results are:

[philippe@localhost rails_projects]$ gem install json -v '1.7.7'
Building native extensions.  This could take a while...

ERROR:  Error installing json:
  ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h


Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out

Has anyone seen that?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
cybertextron
  • 10,547
  • 28
  • 104
  • 208
  • Post the log from Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out into a gist – rovermicrover Apr 09 '13 at 01:06
  • check this link http://stackoverflow.com/questions/11058952/why-do-i-get-an-error-installing-the-json-gem-in-ubuntu – shrikant1712 Apr 09 '13 at 05:27

1 Answers1

1

If you are in a "rpm" system (Fedora or Red Hat) use:

sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel

It solved the problem for me.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
cybertextron
  • 10,547
  • 28
  • 104
  • 208