无法在Ubuntu上使用ruby 2.2.3安装json gem [英] Can not install json gem with ruby 2.2.3 on Ubuntu

查看:114
本文介绍了无法在Ubuntu上使用ruby 2.2.3安装json gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读Rails教程,由于json gem的问题,我无法完成捆绑安装".当我尝试直接安装它时:

I am going through a Rails tutorial and I'm not able to complete 'bundle install' due to a problem with the json gem. When I attempt to install it directly:

me@tru2:~/rails/hello_app$ gem install json -v '1.8.3'
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

    /home/me/.rvm/rubies/ruby-2.2.3-dev/bin/ruby -r ./siteconf20150820-12793-qdkev7.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.so
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
make: *** [generator.so] Error 1

make failed, exit code 2

Gem files will remain installed in /home/me/.rvm/gems/ruby-2.2.3-dev/gems/json-1.8.3 for inspection.
Results logged to /home/me/.rvm/gems/ruby-2.2.3-dev/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out

如前所述,红宝石版本为2.2.3.

As mentioned the ruby version is 2.2.3.

me@tru2:~/rails/hello_app$ ruby --version
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]

运行"gem列表"显示当前已安装json 1.8.1,但默认Gemfile中的某些内容必须要求1.8.3.搜索显示许多类似的问题,但没有答案使我摆脱了这个问题.我曾尝试使用sudo运行,它似乎可以正常工作,但回到我看来,问题仍然存在.

Running 'gem list' shows that json 1.8.1 is currently installed but something in the default Gemfile must require 1.8.3. A search showed many similar questions but no answers that got me past this issue. I have tried running with sudo and it appears to work but going back to me the issue is still there.

推荐答案

cannot find -lgmp表示找不到gmp库.尝试运行:

cannot find -lgmp means that it can't find the gmp library. Try running:

sudo apt-get install libgmp3-dev

https://github.com/flori/json/issues/253

这篇关于无法在Ubuntu上使用ruby 2.2.3安装json gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆