Skip to content

Instantly share code, notes, and snippets.

@simonqian
Last active August 9, 2020 12:31
Show Gist options
  • Save simonqian/f67c862d06c94fe315d0ba97b711571f to your computer and use it in GitHub Desktop.
Save simonqian/f67c862d06c94fe315d0ba97b711571f to your computer and use it in GitHub Desktop.

error info:

➜  hh (develop-hh) ✔ gem install libv8 -v '3.16.14.11'
Building native extensions.  This could take a while...
ERROR:  Error installing libv8:
	ERROR: Failed to build gem native extension.

    current directory: /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/ext/libv8
/Users/simonqian/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20170410-48026-19k49a7.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.13
Using compiler: /usr/bin/c++ (clang version 8.1.0)
../src/bignum.cc:761:7: error: variable 'i' is incremented both in the loop header and in the loop body [-Werror,-Wfor-loop-analysis]
    ++i;
      ^
../src/bignum.cc:756:72: note: incremented here
  for (int i = other.used_digits_ + exponent_diff; i < used_digits_; ++i) {
                                                                       ^
1 error generated.
make[1]: *** [/Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o] Error 1
make: *** [x64.release] Error 2
/Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
	from /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/ext/libv8/location.rb:35:in `each'
	from /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/ext/libv8/location.rb:35:in `verify_installation!'
	from /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/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 -Dwerror=''
  CXX(target) /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o

extconf failed, exit code 1

Gem files will remain installed in /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11 for inspection.
Results logged to /Users/simonqian/.rvm/gems/ruby-2.2.2/extensions/x86_64-darwin-16/2.2.0/libv8-3.16.14.11/gem_make.out

resolve:

➜  hh (develop-hh) ✔ gem install libv8 -v '3.16.14.11' -- --with-system-v8
Building native extensions with: '--with-system-v8'
This could take a while...
Successfully installed libv8-3.16.14.11
Parsing documentation for libv8-3.16.14.11
Installing ri documentation for libv8-3.16.14.11
Done installing documentation for libv8 after 0 seconds
1 gem installed

reference: rubyjs/libv8#205 (comment)

@hopewise
Copy link

it works for me, but I need to run bundle install successfully
currently, for example, if I try to deploy using Capistrano, I get this error:

$ gem install libv8 -v '3.16.14.13' -- --with-system-v8
Building native extensions with: '--with-system-v8'
This could take a while...
Successfully installed libv8-3.16.14.13
1 gem installed
$ bundle exec cap production deploy
Could not find libv8-3.16.14.13 in any of the sources
Run `bundle install` to install missing gems.

then:

$ bundle install
..
..
..

Fetching libv8 3.16.14.13
Installing libv8 3.16.14.13 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/samir/Documents/projects/backend/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13/ext/libv8
/Users/samir/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20190312-65387-t7rtpe.rb extconf.rb --with-cxx=/usr/local/bin/g++-4.2
creating Makefile
/Users/samir/Documents/projects/backend/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13/ext/libv8/builder.rb:53:in `block in build_libv8!': No compilers available (RuntimeError)
	from /Users/samir/Documents/projects/backend/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13/ext/libv8/builder.rb:52:in `chdir'
	from /Users/samir/Documents/projects/backend/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13/ext/libv8/builder.rb:52:in `build_libv8!'
	from /Users/samir/Documents/projects/backend/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:24:in `install!'
	from extconf.rb:7:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/samir/Documents/projects/backend/vendor/bundle/ruby/2.3.0/gems/libv8-3.16.14.13 for inspection.
Results logged to /Users/samir/Documents/projects/backend/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-17/2.3.0/libv8-3.16.14.13/gem_make.out

An error occurred while installing libv8 (3.16.14.13), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.13' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  therubyracer was resolved to 0.12.2, which depends on
    libv8

Any idea?

@hopewise
Copy link

the solution was to bundle install --no-deployment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment