Anton Pleshivtsev
Anton Pleshivtsev

Reputation: 151

Error while trying to gem install json under Ubuntu 12.04

Catching this error under Ubuntu 12.04:

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

/home/allaud/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
creating Makefile

make
compiling generator.c
linking shared-object json/ext/generator.so
gcc: error: generator.o: No such file or directory
make: *** [generator.so] Ошибка 1

Gem files will remain installed in /home/allaud/.rvm/gems/ruby-1.9.3-p392/gems/json-1.7.7 for inspection.
Results logged to /home/allaud/.rvm/gems/ruby-1.9.3-p392/gems/json-1.7.7/ext/json/ext/generator/gem_make.out

I am using fresh rvm and ruby 1.9.3 and have same trouble only with json gem.

The error occurs when I try to execute:

gem install json

If I add sudo everything is ok, but I cannot (and shouldn't) use sudo with rvm commands.

Upvotes: 3

Views: 1272

Answers (3)

Abhinay
Abhinay

Reputation: 1816

Try running below commands(works for ubuntu 14.04):

$ sudo apt-get install libgmp3-dev

and then install json

$ gem install json

Reference: https://www.digitalocean.com/community/questions/how-do-i-fix-this-error-when-deploying-rails-with-capistrano-using-nginx-and-puma

Upvotes: 2

techvineet
techvineet

Reputation: 5111

For me this worked (a solution from @mjgpy3)

sudo apt-get install ruby-json

Upvotes: 0

aelor
aelor

Reputation: 11116

sudo apt-get install ruby1.9.1-dev

may fix it .Cheers !

Upvotes: 3

Related Questions