Following the steps here "gem install therubyracer -v '0.10.2'" on osx mavericks not installing, I was able to get therubyracer -v 0.10.2 and 0.12.0 to install fine, but not 0.11.4.
gem install therubyracer -v 0.11.4
Returns:
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/thooper/.rbenv/versions/2.1.2/bin/ruby -r ./siteconf20150102-7132-9ct9a4.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.9
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
../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]: *** [/Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o] Error 1
make: *** [x64.release] Error 2
/Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/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/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `each'
from /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `verify_installation!'
from /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/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_can_use_vfp_instructions=true
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
extconf failed, exit code 1
Gem files will remain installed in /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17 for inspection.
Results logged to /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/libv8-3.11.8.17/gem_make.out
This line appears a few times in your error message:
The link to the steps you took says to run
brew install apple-gcc42
, which presumably installs GCC 4.2. 4.2 is less than 4.4.The specific error that the C source is generating seems to be:
So if you can somehow edit the makefile (or extconf.rb) to remove those flags, that might also work. However I would recommend installing a compatible compiler instead, because modifying the cflags seems a little hacky.
This is exactly the issue I was having, and I solved it using homebrew-versions.
Problem
I had trouble installing the gem libv8. To solve that problem, I installed v8 on my system via brew, and then used the option
--with-system-v8
.The gem libv8 installed without a problem, however the last line resulted in the error from the original question. I then tried,
pointing it at the v8 provided by brew. In that case, the error changed, and now told me that I had not provided a version of v8 compatible with
3.11.8.13
.For those googling the error message:
Solution
I decided to try installing an earlier version of v8. Using brew again,
This worked. The version of v8 I ended up installing was ~3.15, but this was compatible with 3.11.8
The real solution here is to update everything to the latest version, and I do not advocate using old and out of date gems. Keep your system clean and up-to-date, even if it hurts!
I finally got therubyracer 0.11.4 to install and working using Xcode 6.1.1, 6.2 beta or 6.3 beta (I've tested all 3) and also Xcode 4.6.3 (available at: https://developer.apple.com/downloads/index.action) then running: