无法在digitalocean上安装本机扩展

时间:2015-12-27 01:20:25

标签: ruby-on-rails ruby rubygems digital-ocean

当我在终端上使用命令bundle install时(虽然我已连接到数字海洋服务器),我一直收到此错误。

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

current directory: /usr/local/rvm/gems/ruby-2.2.3/gems/json-1.8.3/ext/json/ext/generator
/usr/local/rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20151226-8411-15s6u34.rb extconf.rb
creating Makefile

current directory: /usr/local/rvm/gems/ruby-2.2.3/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /usr/local/rvm/gems/ruby-2.2.3/gems/json-1.8.3/ext/json/ext/generator
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 /usr/local/rvm/gems/ruby-2.2.3/gems/json-1.8.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out

这适用于大多数宝石,但它们都略有不同,但所有人都说"无法构建宝石原生扩展"。我到处都看,我不确定发生了什么。

1 个答案:

答案 0 :(得分:5)

我假设错误发生在json-1.8.3 gem中,因此尝试

sudo apt-get install libgmp3-dev

然后再次bundle install并查看它是否已修复。