在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
我正在使用新的rvm和ruby 1.9.3并且只与json gem有同样的麻烦。
尝试执行时发生错误:
gem install json
如果我添加sudo一切正常,但我不能(也不应该)使用suv和rvm命令。
答案 0 :(得分:3)
sudo apt-get install ruby1.9.1-dev
可能会解决。欢呼!
答案 1 :(得分:2)
尝试运行以下命令(适用于ubuntu 14.04):
$ sudo apt-get install libgmp3-dev
然后安装json
$ gem install json
答案 2 :(得分:0)
对我来说这很有用(来自@ mjgpy3的解决方案)
sudo apt-get install ruby-json