无法在 digitalocean 上安装本机扩展

Unable to install native extensions on digitalocean

当我在终端中使用命令 bundle install on(同时我已连接到数字海洋服务器)时,我不断收到此错误。

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

这适用于大多数宝石,但它们略有不同,但它们都表示 "Failed to build gem native extension"。我到处都看了,但我不完全确定发生了什么。

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

sudo apt-get install libgmp3-dev

然后再次bundle install,看看是否修复。