rubyjs/therubyracer

Unable to compile dependency libv8 after upgrading to XCode 7.3

scott-knight opened this issue ยท 15 comments

After upgrading to Xcode 7.3 yesterday, libv8 gem version 3.16.14.13 will not compile. This is the error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/ext/libv8 /usr/local/var/rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160324-39259-td12rh.rb extconf.rb creating Makefile Compiling v8 for x64 Using python 2.7.11 Using compiler: /usr/bin/c++ (clang version 7.3.0) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o has no symbols In file included from ../src/accessors.cc:28: In file included from ../src/v8.h:60: In file included from ../src/objects-inl.h:38: In file included from ../src/elements.h:32: ../src/objects.h:5252:44: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] static const int kElementsKindMask = (-1 << kElementsKindShift) & ~~ ^ ../src/objects.h:7386:36: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value](~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ 2 errors generated. make[1]: **\* [/usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o] Error 1 make: **\* [x64.release] Error 2 /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/ext/libv8/location.rb:36:in 'block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/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/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/ext/libv8/location.rb:35:in 'each' from /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/ext/libv8/location.rb:35:in 'verify_installation!' from /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/ext/libv8/location.rb:26:in 'install!' from extconf.rb:7:in '' 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) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o LIBTOOL-STATIC /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/libpreparser_lib.a CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser/preparser/preparser-process.o LINK(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/preparser CXX(target) /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o extconf failed, exit code 1 Gem files will remain installed in /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/gems/libv8-3.16.14.13 for inspection. Results logged to /usr/local/var/rbenv/versions/2.3.0/gemsets/portal4x/extensions/x86_64-darwin-15/2.3.0-static/libv8-3.16.14.13/gem_make.out

However, libv8 version 4.5.95.5 compiles just fine.

+1

+1

Try running gem install libv8 -v '3.16.14.13' -- --with-system-v8
worked for me

http://stackoverflow.com/questions/19673714/rails-gem-install-error-error-installing-libv8-error-failed-to-build-gem-nati/36388366#36388366

This answer is the one that worked for me, found on stack-overflow

brew tap homebrew/versions
brew install v8-315

brew unlink v8 # deviation from stack-overflow answer
brew link --force v8-315 # deviation from stack-overflow answer

gem install libv8 -v '3.16.14.13' -- --with-system-v8
bundle install

bl8nr commented

nice it looks like this solution let me get past the v8 install problem, does anyone know why Rubyracer would be expiring issues now after the successful v8 gem install?

Rubyracer error....

Installing therubyracer 0.12.2 with native extensions

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

/Users/brettbloethner/.rbenv/versions/2.1.2/bin/ruby extconf.rb

checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/brettbloethner/.rbenv/versions/2.1.2/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Users/brettbloethner/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and not the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.13 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location

thanks,
The Mgmt

from /Users/brettbloethner/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.13/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/brettbloethner/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/therubyracer-0.12.2 for inspection.
Results logged to /Users/brettbloethner/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/therubyracer-0.12.2/gem_make.out

I've the same problem...

This might be strange but did work, assuming you have installed v8-315 and v8 installed via brew.

brew unlink v8
brew link --force v8-315
gem install therubyracer -v '0.12.2' -- --with-system-v8

You should be able to do this with out installing v8 and then unlinking and linking but I already had v8 installed. I have only tested with this version above.

+1

aviat commented

This should be fixed now, new binary gems have been release thanks to @ignisf

Closing for now