无法在 ubuntu 中捆绑安装 json gem

无法在 ubuntu 中捆绑安装 json gem

我已经使用 rvm 安装了 ruby​​ on rails 。 我正在尝试捆绑安装我在以前的 PC 上安装的一个旧项目,但是当我运行 bundle install 命令时出现以下错误:

Installing json 1.8.3 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/florin/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20151003-5986-vme5ji.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/florin/.rvm/gems/ruby-2.2.3/gems/json-1.8.3 for inspection.
Results logged to /home/florin/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

通过阅读互联网,我尝试安装所有开发的东西,例如:
sudo apt-get install libpq-dev

sudo apt-get install libmysqlclient-dev
sudo apt-get install libpq-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install libev-dev

但它不起作用。

答案1

/usr/bin/ld: cannot find -lgmp意味着链接器尝试链接lgmp但找不到它。

解决方案:安装所需的库:sudo apt-get install libgmp3-dev

有关的:https://github.com/flori/json/issues/253

相关内容