Kevin Zoltany Kevin Zoltany - 4 years ago 359
Ruby Question

Unable to install native extensions on digitalocean

When i use the command

bundle install
on in terminal (whilst i'm connected to digital oceans server) I keep getting this error.

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


and this is for most of the gems however their all slightly different, but all of them say "Failed to build gem native extension". I've looked everywhere and i'm not entirely sure of what's going on.

Answer Source

I am assuming that the error occurred in json-1.8.3 gem and thus try

sudo apt-get install libgmp3-dev

and then again bundle install and see if it is fixed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download