Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Repeatedly failing to install on Mavericks… #120

Closed
skipchris opened this issue Mar 21, 2014 · 51 comments
Closed

Repeatedly failing to install on Mavericks… #120

skipchris opened this issue Mar 21, 2014 · 51 comments

Comments

@skipchris
Copy link

Hey,

First up, a couple of caveats/apologies:

  1. Sorry if this isn’t the best way/right place to get help - but the README doesn’t make anywhere else clear, so I thought I’d give this a shot as I’ve been stuck for days.
  2. Sorry if this isn’t a libv8 problem, but again, I’ve no idea where else to turn. If you can even point me in the right direction, I’d be grateful.
  3. I’m not looking for someone to sort my life out for me – if you can even suggest some lines of inquiry which might help me out, I’m willing to pursue them, because right now I’m out of ideas.

Basically, I can’t install libv8 (and consequently therubyracer) via bundler on OS X 10.9. I’ve tried lots of different approaches, and nothing seems to work. I’ve been running 10.9 for a while and not seen any problems, but this may be the first time I’ve needed to install libv8 since upgrading, my memory isn’t clear.

I documented the problem pretty comprehensively on Stack Overflow a couple of days ago, but no-one’s been able to help:

https://stackoverflow.com/questions/22481435/fix-therubyracer-libv8-0-12-1-installation-on-mavericks

If you’d like me to reproduce the description here or add any more details, not a problem, just let me know what you need.

Thanks,
Chris.

@cowboyd
Copy link
Collaborator

cowboyd commented Mar 21, 2014

No worries about posting an issue.

What strikes me as strangest is that there is a binary gem for Mavericks, so you should not have to compile it at all. Here is what it looks like on my machine:

~$ gem install libv8 -v3.16.14.3
Fetching: libv8-3.16.14.3-x86_64-darwin-13.gem (100%)
Successfully installed libv8-3.16.14.3-x86_64-darwin-13
Parsing documentation for libv8-3.16.14.3-x86_64-darwin-13
Installing ri documentation for libv8-3.16.14.3-x86_64-darwin-13
Done installing documentation for libv8 after 0 seconds
1 gem installed

So the compiler shouldst need never get involved.

Here is the output of the following on my mavericks box.

~$ ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
x86_64-darwin-13

What happens when you run the above commands from a clean gemset?

@skipchris
Copy link
Author

Hey,

Thanks for the help. Agree with what you’re saying, in my (limited) understanding, my problem doesn’t "make sense", because of how libv8 actually works!

I ran the above command:

$ ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
x86_64-darwin-10

:/

@ignisf
Copy link
Collaborator

ignisf commented Mar 21, 2014

Your Ruby version has been compiled on an older version of MacOS. This causes RUBY_PLATFORM to indicate darwin10. A workaround is to recompile Ruby.

@cowboyd
Copy link
Collaborator

cowboyd commented Mar 21, 2014

Yes. As @ignisf indicates, my first line of attack would be to re-install/re-compile ruby.

@skipchris
Copy link
Author

Cool, thanks.

At a guess, do you think it’s probably worth imploding rvm and starting from scratch?

"Nuke the entire site from orbit – it's the only way to be sure"

@cowboyd
Copy link
Collaborator

cowboyd commented Mar 21, 2014

If this is indeed your problem, then you will probably save yourself some trouble down the road by doing so. If this fixed your issue, I'm going to go ahead and mark this closed.

@cowboyd cowboyd closed this as completed Mar 21, 2014
@skipchris
Copy link
Author

Works a treat. Thank you so much.

@rrosen
Copy link

rrosen commented Mar 23, 2014

Hey folks-- I'm having the same issue here and starting to get stumped. Upgraded to Mavericks, reinstalled ruby via RVM, and now I can't manage to install libv8. I've tried the above suggestions, and everything looks right, but it's still trying to compile the extension rather than download and use the binary gem. Here's what I get

✗ ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
x86-darwin-13
✗ gem install libv8 -v3.16.14.3
Building native extensions.  This could take a while...
ERROR:  Error installing libv8:
    ERROR: Failed to build gem native extension.

    /Users/rrosen/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
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
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/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/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
/Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/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 /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
    from /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!'
    from extconf.rb:7
Using python 2.7.5
Using compiler: g++
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) /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/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 /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/gems/libv8-3.16.14.3 for inspection.
Results logged to /Users/rrosen/.rvm/gems/ree-1.8.7-2012.02@usgbc-gbig/extensions/x86-darwin-13/1.8/libv8-3.16.14.3/gem_make.out

As you can see, the ruby for this project is REE. Would that keep it from using the binary gem?

It was news to me that binary gems even existed, and I'm having trouble finding documentation about them, so any pointers in that direction would be most welcome too.

@ignisf
Copy link
Collaborator

ignisf commented Mar 24, 2014

Hello @rrosen,
In short, yes, using REE would keep you from using the binary gem.

You could try to use the current HEAD version, as explained here https://github.com/cowboyd/libv8#using-a-git-version. It should compile on Mavericks.

@stevecj
Copy link

stevecj commented Mar 31, 2014

I'm having the same problem (also with REE on Mavericks), and the recommended solution is not working for me.

I added the following to my Gemfile...

gem 'libv8', :git => "git://github.com/cowboyd/libv8.git", :submodules => true

... and this is what I got when trying bundle install ...

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/stevej/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby extconf.rb
creating Makefile
/Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/compiler.rb:27:in `find': undefined method `capture3' for Open3:Module (NoMethodError)
    from /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/compiler.rb:22:in `available_compilers'
    from /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/compiler.rb:22:in `map'
    from /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/compiler.rb:22:in `available_compilers'
    from /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/builder.rb:86:in `choose_compiler'
    from /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/builder.rb:16:in `initialize'
    from /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/location.rb:23:in `new'
    from /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/location.rb:23:in `install!'
    from extconf.rb:7


Gem files will remain installed in /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0 for inspection.
Results logged to /Users/stevej/.rvm/gems/ree-1.8.7-2012.02@310/bundler/gems/libv8-9ff2eb02a4c0/ext/libv8/gem_make.out
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.

I think I'm going to have to install Vagrant now in order to keep doing work on this project.

@jmangs
Copy link

jmangs commented Apr 1, 2014

I ran into this problem as well with bundle install being terrible. I was able to compile libv8 using gem install v8 so I knew it wasn't a problem to compile on Mavericks. I actually manually compiled the gem and pointed it at my vendor/bundle path like this:

gem install libv8 -v '3.16.14.3' --install-dir vendor/bundle/ruby/1.9.1/

Note I used a relative path up there so you may have adjust for that and the actual version of ruby you're using. bundle install should then pick up that it's already installed and carry on. Hope this helps.

@cowboyd
Copy link
Collaborator

cowboyd commented Apr 2, 2014

@stevecj I don't know why capture3 wouldn't exist on REE. Can you find that method via IRB?

@cowboyd
Copy link
Collaborator

cowboyd commented Apr 2, 2014

@jmangs can you gem install libv8? If so, I find it very odd that it would not use that installation for that same version of ruby.

@rrosen
Copy link

rrosen commented Apr 2, 2014

Thanks for the tips @ignisf

I was just using therubyracer for rails asset pipeline functionality, so I wound up replacing it with execjs and node intalled via homebrew.

@ignisf
Copy link
Collaborator

ignisf commented Apr 6, 2014

@cowboyd should we add REE to travis?

@cowboyd
Copy link
Collaborator

cowboyd commented Apr 7, 2014

I think so. We should probably keep it in sync with the builds for the therubyracer since one it will not work with a functioning libv8.

@nelsonenzo
Copy link

This still appears to be an issue using:
OSX 10.9.2
Ruby 1.8.7-p375
Tried with gcc-4.2 and gcc-4.8

tl;dr libv8 is still trying to compile even though I am supposedly on an supported platform. 2 days and still have not been able to resolve issue :(

ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
x86-darwin-13
gem install libv8 -v '3.16.14.1'
Fetching: libv8-3.16.14.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing libv8:
    ERROR: Failed to build gem native extension.

        /Users/cs/.rbenv/versions/1.8.7-p375/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
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
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/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o] Error 1
make: *** [x64.release] Error 2
/Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/ext/libv8/location.rb:36:in `verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/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/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/ext/libv8/location.rb:35:in `each'
    from /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/ext/libv8/location.rb:26:in `install!'
    from extconf.rb:7
Using python 2.7.5
Using compiler: g++
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) /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o


Gem files will remain installed in /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1 for inspection.
Results logged to /Users/cs/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.1/ext/libv8/gem_make.out

I also tried with gcc-4.8, different error but still does not install properly

gem install libv8 -- --with-cxx=gcc-4.8
Building native extensions.  This could take a while...
ERROR:  Error installing libv8:
    ERROR: Failed to build gem native extension.

        /Users/adam/.rbenv/versions/1.8.7-p375/bin/ruby extconf.rb --with-cxx=gcc-4.8
creating Makefile
Compiling v8 for x64
gcc-4.8: error: unrecognized command line option '-Wnewline-eof'
make[1]: *** [/Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o] Error 1
make: *** [x64.release] Error 2
/Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/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 /Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
    from /Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
    from /Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!'
    from extconf.rb:7
Using python 2.7.5
Using compiler: /usr/local/bin/gcc-4.8
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) /Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o


Gem files will remain installed in /Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3 for inspection.
Results logged to /Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/libv8-3.16.14.3/ext/libv8/gem_make.out

libv8 would appear to install successfully if I install v8 via homebrew and specify with system v8

brew install v8
gem install libv8 -- --with-system-v8
=> Building native extensions.  This could take a while...
Successfully installed libv8-3.16.14.3
1 gem installed
Installing ri documentation for libv8-3.16.14.3...
Installing RDoc documentation for libv8-3.16.14.3...

But does not really seem to work. therubyracer will fail on

 gem install therubyracer
Fetching: ref-1.0.5.gem (100%)
Fetching: therubyracer-0.12.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

        /Users/adam/.rbenv/versions/1.8.7-p375/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
creating Makefile

make
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 -I. -I. -I/Users/adam/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin13.1.0 -I. -I/Users/adam/.rbenv/versions/1.8.7-p375/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/adam/.rbenv/versions/1.8.7-p375/include  -Wall -g -rdynamic -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common    -c accessor.cc
In file included from accessor.cc:1:
rr.h:463: error: ‘AccessorGetter’ in namespace ‘v8’ does not name a type
rr.h:464: error: ‘AccessorSetter’ in namespace ‘v8’ does not name a type
rr.h:466: error: ‘NamedPropertyGetter’ in namespace ‘v8’ does not name a type
..... (more like this)

I have been able to reproduce this on multiple OSX 10.9.2, both with fresh OSX Mavericks installs.
A month ago on my personal laptop I was able to work past this by installing gcc-4.2 and re-install ruby 1.8.7, the gem installing, but alas, it does not work now. Perhaps an update to Mavericks broke something here?

On both systems:

 ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
x86-darwin-13

brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 637805eed563da9f7dac26f7f3887adc2add76c7
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.9.2-x86_64
Xcode: 5.1.1
CLT: 5.1.0.0.1.1396320587
GCC-4.2: build 5666
Clang: 5.1 build 503
X11: N/A
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/adam/.rbenv/shims/ruby

Have been working on it for over 2 days now, will gladly help debug further / video pair. This is very painful.
Maybe worth noting, if I use ruby >= 1.9.3 then everything works as expected. libv8 and therubyracer will install fine.

@rogermarlow
Copy link

I'm having the same experience as @nelsonenzo. We install libv8 --with-system-v8 because of difficulties building V8 locally. That --with flag causes the libv8 Makefile to contain system header paths, rather paths to the "vendor" headers. I don't know why the system headers don't work but if I put back the path to the vendor headers into the Makefile in the therubyracer directory where the compile failed:

$ vi ~/.rvm/gems/ruby-1.9.3-p545/gems/therubyracer-0.11.3/ext/v8/Makefile

by adding the following into INCFLAGS on line 72 (adjust the path for whatever your usage of rvm, ruby version and libv8 installation location)

-I/Users/[your-user-here]/.rvm/gems/ruby-1.9.3-p545/gems/libv8-3.11.8.13/vendor/v8/include

then cd to that directory and re-do the make:

$ make clean
$ make

The compile succeeds (with warnings) and I can go back to my application and bundle install without a problem.

I don't know why this magically works under Ruby 2.1.

@stevecj
Copy link

stevecj commented Jun 2, 2014

@rogermarlow Your workaround was going to be my last hope, but there is no Makefile file in my ~/.rvm/gems/ree-1.8.7-2012.02@310/gems/therubyracer-0.12.1/ext/v8 directory after trying to install. What now? Good excuse to finally upgrade the Ruby version for this project? I was hoping to actually try to actually work on delivering features again soon. Sigh :(

@stevecj
Copy link

stevecj commented Jun 2, 2014

Thanks @rogermarlow. I finally solved the problem by finally deciding to go ahead and upgrade the Ruby version on the project. It took me less than an hour, including fixing test failures. If I'd known it would go that smoothly, I'd have done that in the first place. Anyway, all is well now. I'm having no trouble installing any gems w/ Ruby 1.9.3.

@ignisf
Copy link
Collaborator

ignisf commented Jun 15, 2014

On the REE support -- my personal opinion is that the libv8 gem does not need to strive for backwards compatibility with such an archaic AND unsupported version of Ruby. Please consider migrating to a newer version.

@stevecj
Copy link

stevecj commented Jun 15, 2014

@ignisf I agree. I had been looking for workarounds, not official support. Having finally managed to divest everything I work on of REE, I no longer need workarounds either. :)

@skandragon
Copy link

I'm having this issue on OS X 10.10 (Yosemite) pre-release as well.

ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]

This is a freshly built ruby, using xcode6-beta.

@volkanunsal
Copy link

This is happening for me too on ruby-2.0.0-p247.

@gabereiser
Copy link

this is also happening to me, 10.10 using rbenv and ruby-2.0.0-p247

@chrisb
Copy link

chrisb commented Jul 22, 2014

Yep, hitting this on 10.10 as well.

@lucidtech
Copy link

ditto. 10.10 r4 xcode beta 6 CLT tried 2.1.2 & 1.9.3

--update--
i got the --with flag to work
gem install libv8 -v '3.16.14.3' -- --with-system-v8

@tataihono
Copy link

This worked for me:

git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake clean build binary
gem install pkg/libv8-<compiled_version_number>.gem

This answer was given on StackOverflow.

@mattheworiordan
Copy link

@rogermarlow unfortunately that did not work for me, I still can't install the Gem, although the make now builds as you had suggested once including the V8 headers.

My ruby version is 2.0.0-p353, and my libv8 gem (that compiled when using gem install libv8 -- --with-system-v8) is version 3.16.14.3.

Here is what happens.

make builds OK

$ cd ~/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.1/ext/v8
$ make
compiling accessor.cc
clang: warning: argument unused during compilation: '-rdynamic'
....
init.cc:11:20: warning: empty parentheses interpreted as a function declaration [-Wvexing-parse]
    v8::Locker lock();
                   ^~
init.cc:11:20: note: remove parentheses to declare a variable
    v8::Locker lock();
                   ^~
init.cc:11:16: warning: 'lock' has C-linkage specified, but returns user-defined type 'v8::Locker' which is incompatible with C [-Wreturn-type-c-linkage]
    v8::Locker lock();
               ^
2 warnings generated.
compiling invocation.cc
clang: warning: argument unused during compilation: '-rdynamic'
...
linking shared-object v8/init.bundle

gem install fails

$ gem list | grep theruby
# => confirms therubyracer is not an installed gem

$ gem install therubyracer
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    /Users/matthew/.rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
creating Makefile

make "DESTDIR="
compiling accessor.cc
clang: warning: argument unused during compilation: '-rdynamic'
In file included from accessor.cc:1:
./rr.h:463:14: error: no type named 'AccessorGetter' in namespace 'v8'
  inline v8::AccessorGetter accessorGetter() {return &AccessorGetter;}
         ~~~~^
./rr.h:464:14: error: no type named 'AccessorSetter' in namespace 'v8'
  inline v8::AccessorSetter accessorSetter() {return RTEST(set) ? &AccessorSetter : 0;}
         ~~~~^
./rr.h:466:14: error: no type named 'NamedPropertyGetter' in namespace 'v8'
  inline v8::NamedPropertyGetter namedPropertyGetter() {return &NamedPropertyGetter;}
         ~~~~^
./rr.h:467:14: error: no type named 'NamedPropertySetter' in namespace 'v8'
  inline v8::NamedPropertySetter namedPropertySetter() {return RTEST(set) ? &NamedPropertySetter : 0;}
         ~~~~^
./rr.h:468:14: error: no type named 'NamedPropertyQuery' in namespace 'v8'
  inline v8::NamedPropertyQuery namedPropertyQuery() {return RTEST(query) ? &NamedPropertyQuery : 0;}
         ~~~~^
./rr.h:469:14: error: no type named 'NamedPropertyDeleter' in namespace 'v8'
  inline v8::NamedPropertyDeleter namedPropertyDeleter() {return RTEST(deleter) ? &NamedPropertyDeleter : 0;}
         ~~~~^
./rr.h:470:14: error: no type named 'NamedPropertyEnumerator' in namespace 'v8'
  inline v8::NamedPropertyEnumerator namedPropertyEnumerator() {return RTEST(enumerator) ? &NamedPropertyEnumerator : 0;}
         ~~~~^
./rr.h:472:14: error: no type named 'IndexedPropertyGetter' in namespace 'v8'
  inline v8::IndexedPropertyGetter indexedPropertyGetter() {return &IndexedPropertyGetter;}
         ~~~~^
./rr.h:473:14: error: no type named 'IndexedPropertySetter' in namespace 'v8'
  inline v8::IndexedPropertySetter indexedPropertySetter() {return RTEST(set) ? &IndexedPropertySetter : 0;}
         ~~~~^
./rr.h:474:14: error: no type named 'IndexedPropertyQuery' in namespace 'v8'
  inline v8::IndexedPropertyQuery indexedPropertyQuery() {return RTEST(query) ? &IndexedPropertyQuery : 0;}
         ~~~~^
./rr.h:475:14: error: no type named 'IndexedPropertyDeleter' in namespace 'v8'
  inline v8::IndexedPropertyDeleter indexedPropertyDeleter() {return RTEST(deleter) ? &IndexedPropertyDeleter : 0;}
         ~~~~^
./rr.h:476:14: error: no type named 'IndexedPropertyEnumerator' in namespace 'v8'
  inline v8::IndexedPropertyEnumerator indexedPropertyEnumerator() {return RTEST(enumerator) ? &IndexedPropertyEnumerator : 0;}
         ~~~~^
./rr.h:482:16: error: no type named 'AccessorInfo' in namespace 'v8'; did you mean 'Accessor'?
    Info(const v8::AccessorInfo& info);
               ^~~~~~~~~~~~~~~~
               Accessor
./rr.h:456:7: note: 'Accessor' declared here
class Accessor {
      ^
./rr.h:488:18: error: no type named 'AccessorInfo' in namespace 'v8'; did you mean 'Accessor'?
    inline const v8::AccessorInfo* operator->() {return this->info;}
                 ^~~~~~~~~~~~~~~~
                 Accessor
./rr.h:456:7: note: 'Accessor' declared here
class Accessor {
      ^
./rr.h:502:11: error: no type named 'AccessorInfo' in namespace 'v8'; did you mean 'Accessor'?
    const v8::AccessorInfo* info;
          ^~~~~~~~~~~~~~~~
          Accessor
./rr.h:456:7: note: 'Accessor' declared here
class Accessor {
      ^
./rr.h:506:85: error: no type named 'AccessorInfo' in namespace 'v8'; did you mean 'Accessor'?
  static v8::Handle<v8::Value> AccessorGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
                                                                                    ^~~~~~~~~~~~~~~~
                                                                                    Accessor
./rr.h:456:7: note: 'Accessor' declared here
class Accessor {
      ^
./rr.h:507:96: error: no type named 'AccessorInfo' in namespace 'v8'; did you mean 'Accessor'?
  static void AccessorSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
                                                                                               ^~~~~~~~~~~~~~~~
                                                                                               Accessor
./rr.h:456:7: note: 'Accessor' declared here
class Accessor {
      ^
./rr.h:509:90: error: no type named 'AccessorInfo' in namespace 'v8'; did you mean 'Accessor'?
  static v8::Handle<v8::Value> NamedPropertyGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
                                                                                         ^~~~~~~~~~~~~~~~
                                                                                         Accessor
./rr.h:456:7: note: 'Accessor' declared here
class Accessor {
      ^
./rr.h:510:118: error: no type named 'AccessorInfo' in namespace 'v8'; did you mean 'Accessor'?
  static v8::Handle<v8::Value> NamedPropertySetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
                                                                                                                     ^~~~~~~~~~~~~~~~
                                                                                                                     Accessor
./rr.h:456:7: note: 'Accessor' declared here
class Accessor {
      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [accessor.o] Error 1


Gem files will remain installed in /Users/matthew/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.1 for inspection.
Results logged to /Users/matthew/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.1/ext/v8/gem_make.out

$ cat Makefile | grep INCFLAGS
# => INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
# Shows that the Gem install overwrites the Makefile I have just modified

Am I missing something? How can I ensure the gem uses the modified Makefile? The only viable option I can think of is to create my own version of the Gem and install it, which I will probably do now, but wondering if there was a better way

@rogermarlow
Copy link

@mattheworiordan it's a while ago now but I usually ask bundler to figure out what was already installed and what needed building, so my manual make process must have fooled bundler into thinking that gem was now installed and it skipped it and moved on to the others. So in short avoid gem install and use bundle install instead.

@mattheworiordan
Copy link

Thanks @rogermarlow, but unfortunately that didn't work either :|

@jk779
Copy link

jk779 commented Sep 4, 2014

Same Issue on 10.10 as @mattheworiordan :(

@dunghuynh
Copy link

Reinstalling ruby 2.1.2p95 and bundle install does not work for me.
I have to gem uninstall libv8 and install therubyracer without bundler
gem install therubyracer

@fernandoaleman
Copy link

I'm having the same problem on 10.10 (Yosemite) and 1.9.3-p429

@jk779
Copy link

jk779 commented Sep 12, 2014

I can confirm that i had to compile the libv8 gem on Yosemite myself in order to make therubyracer working as per @ardation's last comment.
Installation of libv8 with --with-system-v8 results in errors when installing therubyracer (the same errors as @mattheworiordan)

Here's the binary of 3.16.14.3 that this resulted in.
$ shasum libv8-3.16.14.3.gem
58fc902f583a28d5295e8d2833ad80abc16e05e6 libv8-3.16.14.3.gem

@calexicoz
Copy link

Just a quick note for those trying to install on Mavericks with REE.

I'm not sure how well that would work for other versions, but it may be worth a try.

Looking at @rogermarlow comment, I was able to get it working with (adapt path to gem):

brew install libv8
gem install libv8 -v '3.16.14.3' -- --with-system-v8
CPATH=$HOME/.gem/ruby/1.8/gems/libv8-3.16.14.3/vendor/v8/include gem install therubyracer -v '0.12.1'

@calexicoz
Copy link

Well, I spoke too fast. I now get

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: ~/.gem/ruby/1.8.7/gems/therubyracer-0.12.1/lib/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: ~/.gem/ruby/1.8.7/gems/therubyracer-0.12.1/lib/v8/init.bundle
  Expected in: flat namespace

@rafaelrinaldi
Copy link

Having this issue in Yosemite as well. Fresh ruby 2.1.1 install.

@johnfig
Copy link

johnfig commented Oct 20, 2014

I have the same issue as @rafaelrinaldi

@rafaelrinaldi
Copy link

@johnfig I've managed to get it done:

CC=gcc rbenv install 2.1.1

It seems to be a ruby-build issue.

@vyorkin
Copy link

vyorkin commented Oct 21, 2014

@rafaelrinaldi maybe, there is an open issue rbenv/ruby-build#651,
here is how i've solved it:

brew install v8
gem install libv8 -v '3.16.14.3' -- --with-system-v8

@bronson
Copy link

bronson commented Oct 26, 2014

I'm having this problem on Yosemite too. Is this the problem?

$ ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
x86_64-darwin-14

My Mavericks machine returns x86_64-darwin-13, and everything works there.

Will someone eventually upload a -14 gem binary?

(the --with-system-v8 is not a good workaround because our entire team will have to do it... that won't be fun.)

@bronson
Copy link

bronson commented Oct 26, 2014

Dangit, I apologize. I didn't see #124. That solves my issue, everything's good here.

@plicjo
Copy link

plicjo commented Nov 15, 2014

@vyorkin That worked for me. Thanks!

@alexey
Copy link

alexey commented Apr 14, 2015

I had similar problem leading to therubyracer installation fail.

I solved it with:

sudo ln -s /Library/Developer/CommandLineTools/usr/bin/cpp /usr/bin/cpp
sudo ln -s /Library/Developer/CommandLineTools/usr/bin/gcc /usr/bin/gcc
sudo ln -s /Library/Developer/CommandLineTools/usr/bin/g++ /usr/bin/g++
brew uninstall v8
gem install libv8
gem install therubyracer

From here: http://github.com/cowboyd/therubyracer/issues/307

@ksarna
Copy link

ksarna commented Jul 2, 2015

Tried everything: reinstalling rubies, nuking rvm, brew v8, --with-system-v8, cloning libv8 and trying to run rake install, downgrading command line tools to 6.2. Nothing helped. Luckily a version 6.4 of xcode arrived and bundle install just worked. sigh

@cowboyd
Copy link
Collaborator

cowboyd commented Jul 2, 2015

@ksarna The biggest problem was that developers on OSX should never have to compile libv8 ever because there is a binary gem for mavericks. It turned out to be an issue with rubygems, where a binary gem built with rubygems < 2.2 would not be selected by rubygems > 2.4.

The 6.4 commandline tools are still incompatible with the version of v8 we use, but last night I released a new binary gem build with rubygems 2.4.2 which is selected correctly.

Hopefully this resolves further issues.

@ksarna
Copy link

ksarna commented Jul 2, 2015

@cowboyd sounds good! Thanks for the info and your work.

@jikkujose
Copy link

@calexicoz exactly the same issue here!

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/jikkujose/.gem/ruby/2.2.2/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/jikkujose/.gem/ruby/2.2.2/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

This is what I did, before starting the server.

brew install v8
gem install libv8 -v '3.16.14.7' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-system-v8

System config:
El Capitan
Ruby: 2.2.2

Any more information is required?

@Vorob-Astronaut
Copy link

+1

@ghost
Copy link

ghost commented Jan 27, 2016

@jikkujose Same issue here

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/warp/development/opensource/rails-loaded/vendor/ruby/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/warp/development/opensource/rails-loaded/vendor/ruby/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

Trace/BPT trap: 5

El Capitan
ruby 2.1.6p336

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests