GHx
GHx

Reputation: 43

Ruby gems bundle install failure

I am installing Diaspora (open source social networking) in Ubuntu 16.04 using these directions. Installation instructions call for using Ruby Version Manager to install Ruby and then using Bundler to add some required gems. Ruby installs, then the command to use the bundler

:~/diaspora$ bin/bundle install --full-index

makes some progress and then fails at this step:

Fetching unf_ext 0.0.7.4
Installing unf_ext 0.0.7.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    current directory:/home/ubuntu/diaspora/vendor/bundle/ruby/2.4.0/gems/unf_ext-0.0.7.4/ext/unf_ext
/home/ubuntu/.rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20180215-26943-187isn6.rb extconf.rb
checking for -lstdc++... yes
creating Makefile

current directory: /home/ubuntu/diaspora/vendor/bundle/ruby/2.4.0/gems/unf_ext-0.0.7.4/ext/unf_ext
make "DESTDIR=" clean

current directory: /home/ubuntu/diaspora/vendor/bundle/ruby/2.4.0/gems/unf_ext-0.0.7.4/ext/unf_ext
make "DESTDIR="
compiling unf.cc
cc1plus: warning: command line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++
virtual memory exhausted: Cannot allocate memory
Makefile:209: recipe for target 'unf.o' failed
make: *** [unf.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/ubuntu/diaspora/vendor/bundle/ruby/2.4.0/gems/unf_ext-0.0.7.4 for inspection.
Results logged to /home/ubuntu/diaspora/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0/unf_ext-0.0.7.4/gem_make.out

An error occurred while installing unf_ext (0.0.7.4), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.7.4'` succeeds before bundling.

In Gemfile:
  asset_sync was resolved to 2.2.0, which depends on
     unf was resolved to 0.1.4, which depends on
        unf_ext

I updated to gcc-7 and g++-7, and appear to be using them:

:~/diaspora$ update-alternatives --display gcc
gcc - auto mode
  link best version is /usr/bin/gcc-7
  link currently points to /usr/bin/gcc-7
  link gcc is /usr/bin/gcc
/usr/bin/gcc-7 - priority 10
:~/diaspora$ update-alternatives --display g++
g++ - auto mode
  link best version is /usr/bin/g++-7
  link currently points to /usr/bin/g++-7
  link g++ is /usr/bin/g++
/usr/bin/g++-7 - priority 10

I also successfully installed unf_ext without Bundler using

:~/diaspora$ gem install unf_ext -v '0.0.7.4'

and it is there:

:~/diaspora$ gem list

*** LOCAL GEMS ***

bigdecimal (default: 1.3.0)
bundler (default: 1.16.1)
bundler-unload (1.0.2)
did_you_mean (1.1.0)
executable-hooks (1.3.2)
gem-wrappers (1.3.2, 1.2.7)
io-console (default: 0.4.6)
json (default: 2.0.2)
minitest (5.10.1)
net-telnet (0.1.1)
openssl (default: 2.0.3)
power_assert (0.4.1)
psych (default: 2.2.2)
rake (12.0.0)
rdoc (default: 5.0.0)
rubygems-bundler (1.4.4)
rubygems-update (2.7.5, 2.6.14)
rvm (1.11.3.9)
test-unit (3.2.3)
unf_ext (0.0.7.5, 0.0.7.4, 0.0.7.2)
xmlrpc (0.2.1)

... but the same error persists.

Looking to understand the source of the error and how to resolve.

Upvotes: 0

Views: 1026

Answers (1)

Anthony L
Anthony L

Reputation: 2169

Your box is running out of memory during the installation:

virtual memory exhausted: Cannot allocate memory

It is killing the install. You should increase your system's memory.

Upvotes: 2

Related Questions