Hiro
Hiro

Reputation: 359

bundle install doesn't succeed

I'm currently helping this rails project. (I just started ruby, even programming, so please go easy on me...) when I tried to bundle install with project shared Gemfile/Gemfile.lock, it causes some fuss with json 1.8.1 and libv8 3.16.14.3 install.

I hit some search result and half of the answers involved bundle update, which is, according to much more experience team member, a taboo when working in a team because it brings a chaos to project Gemfile.lock.

I tried the other half with different things like El-Captain related Recovery mode bit or gem update -system or libv8 related things. It seems any of those didn't work.

Then again, it's highly possible I didn't use precise inquiry to search for the answers, since I am a beginner and don't have much knowledge or guess about what's usually causing issue or 'this is base library so i should get this done right.' or stuff like that.

If someone could help me, that would be great kindness. I'm going to leave the log here:

Installing json 1.8.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/json-

1.8.1/ext/json/ext/generator
/usr/local/opt/ruby/bin/ruby -r ./siteconf20160607-22004-lr43ei.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                              ^
/usr/local/Cellar/ruby/2.3.1/include/ruby-2.3.0/ruby/intern.h:797:9: note: macro 'rb_str_new' defined here

#define rb_str_new(str, len) __extension__ (    \
        ^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' (aka 'unsigned long (const char *, long)') [-Wint-conversion]
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
          ^        ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/json-1.8.1/gem_make.out
Installing libv8 3.16.14.3 with native extensions

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

    current directory: /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/ext/libv8
/usr/local/opt/ruby/bin/ruby -r ./siteconf20160607-22004-1gr1tzk.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.10
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Using compiler: /usr/bin/g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable]
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);
                 ^
1 error generated.
make[1]: *** [/usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o] Error 1
make: *** [x64.release] Error 2
/usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
    from /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
    from /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
    from /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!'
    from extconf.rb:7:in `<main>'
GYP_GENERATORS=make \
    build/gyp/gyp --generator-output="out" build/all.gyp \
                  -Ibuild/standalone.gypi --depth=. \
                  -Dv8_target_arch=x64 \
                  -S.x64  -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3
  CXX(target) /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/libv8-3.16.14.3/gem_make.out

I'm so sorry guys, I'm using Mac!

Upvotes: 0

Views: 373

Answers (5)

vipin
vipin

Reputation: 2510

First delete your Gemfile.lock file, then

bundle install

Upvotes: 1

Hiro
Hiro

Reputation: 359

I found the reason of this failure, which was the compatibility of the versions of those gems and ruby version.

I very much knew that could be a problem, but I thought I made sure I set the proper ruby version for the gems versions specified in the Gemfile/Gemfile.lock. What I did miss was the trace of misconfigure of rbenv, which is shown as '2.3.0' in the log. What I thought it should have been was '2.0.0'.

Since I didn't do good rbenv setup, bundler was referring to the ruby not in the project directory. Hence obvious version incompatibilities.

Upvotes: 1

T Edi
T Edi

Reputation: 13

I was having a similar problem to yours, except for me I only got an error related to the json gem (same version number and everything). I found this solution and it worked for me (I had to delete the Gemfile.lock first though). Hope it helps you out a bit!

Upvotes: 0

Mukesh
Mukesh

Reputation: 931

Try this one:

sudo apt-get install nodejs

Upvotes: 0

Ruben Barbosa
Ruben Barbosa

Reputation: 151

ERROR: Failed to build gem native extension.

This could be because you don't have node.js installed :

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs

Upvotes: 0

Related Questions