rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 191 forks source link

Install Mac OS 10.10.3 #339

Closed idoo closed 9 years ago

idoo commented 9 years ago

Default install way bring me errors, but i could install through this way:

brew install v8
gem install libv8 -v '3.16.14.3' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-system-v8
tian-xiaobo commented 9 years ago

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

/usr/local/var/rbenv/versions/2.1.5/bin/ruby extconf.rb 

checking for main() in -lpthread... yes checking for main() in -lobjc... yes creating Makefile

make "DESTDIR=" clean

make "DESTDIR=" compiling accessor.cc clang: warning: argument unused during compilation: '-rdynamic' In file included from accessor.cc:1: In file included from ./rr.h:6: In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:265: In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__bit_reference:15: In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:628: In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:604: /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:341:10: fatal error: '__debug' file not found

include <__debug>

     ^

1 error generated. make: *\ [accessor.o] Error 1

make failed, exit code 2

Gem files will remain installed in /use/36kr/bundle/ruby/2.1.0/gems/therubyracer-0.12.2 for inspection. Results logged to /use/36kr/bundle/ruby/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/therubyracer-0.12.2/gem_make.out An error occurred while installing therubyracer (0.12.2), and Bundler cannot continue. Make sure that gem install therubyracer -v '0.12.2' succeeds before bundling.

ignisf commented 9 years ago

@tian-xiaobo, https://github.com/cowboyd/therubyracer/issues/338

rporrasluc commented 9 years ago

I am coping with this issue when trying to install therubyracer 0.11.4 on Mac OS 10.10.3.

I am getting these errors:

Building native extensions with: '--with-system-v8'
This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    /Users/rafaelporraslucena/.rbenv/versions/2.0.0-p481/bin/ruby extconf.rb --with-system-v8
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:
In file included from ./rr.h:4:
/usr/local/include/v8.h:3915:36: error: 'v8::PropertyHandlerFlags' is not a class, namespace, or scoped enumeration
      PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
                                   ^
/usr/local/include/v8.h:3943:36: error: 'v8::PropertyHandlerFlags' is not a class, namespace, or scoped enumeration
      PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
                                   ^
In file included from accessor.cc:1:
./rr.h:358:39: error: no member named 'ScriptData' in namespace 'v8'
class ScriptData : public Pointer<v8::ScriptData> {
                                  ~~~~^
./rr.h:358:51: error: expected class name
class ScriptData : public Pointer<v8::ScriptData> {
                                                  ^
./rr.h:360:21: error: no type named 'ScriptData' in namespace 'v8'; did you mean simply 'ScriptData'?
  inline ScriptData(v8::ScriptData* d) : Pointer<v8::ScriptData>(d) {};
                    ^~~~~~~~~~~~~~
                    ScriptData
./rr.h:358:7: note: 'ScriptData' declared here
class ScriptData : public Pointer<v8::ScriptData> {
      ^
./rr.h:360:54: error: no member named 'ScriptData' in namespace 'v8'
  inline ScriptData(v8::ScriptData* d) : Pointer<v8::ScriptData>(d) {};
                                                 ~~~~^
./rr.h:360:65: error: expected class member or base class name
  inline ScriptData(v8::ScriptData* d) : Pointer<v8::ScriptData>(d) {};
                                                                ^
./rr.h:360:65: error: expected '{' or ','
./rr.h:361:48: error: no member named 'ScriptData' in namespace 'v8'
  inline ScriptData(VALUE value) : Pointer<v8::ScriptData>(value) {}
                                           ~~~~^
./rr.h:361:59: error: expected class member or base class name
  inline ScriptData(VALUE value) : Pointer<v8::ScriptData>(value) {}
                                                          ^
./rr.h:361:59: error: expected '{' or ','
./rr.h:462:14: error: no type named 'AccessorGetter' in namespace 'v8'
  inline v8::AccessorGetter accessorGetter() {return &AccessorGetter;}
         ~~~~^
./rr.h:463:14: error: no type named 'AccessorSetter' in namespace 'v8'
  inline v8::AccessorSetter accessorSetter() {return RTEST(set) ? &AccessorSetter : 0;}
         ~~~~^
./rr.h:465:14: error: no type named 'NamedPropertyGetter' in namespace 'v8'
  inline v8::NamedPropertyGetter namedPropertyGetter() {return &NamedPropertyGetter;}
         ~~~~^
./rr.h:466:14: error: no type named 'NamedPropertySetter' in namespace 'v8'
  inline v8::NamedPropertySetter namedPropertySetter() {return RTEST(set) ? &NamedPropertySetter : 0;}
         ~~~~^
./rr.h:467:14: error: no type named 'NamedPropertyQuery' in namespace 'v8'
  inline v8::NamedPropertyQuery namedPropertyQuery() {return RTEST(query) ? &NamedPropertyQuery : 0;}
         ~~~~^
./rr.h:468:14: error: no type named 'NamedPropertyDeleter' in namespace 'v8'
  inline v8::NamedPropertyDeleter namedPropertyDeleter() {return RTEST(deleter) ? &NamedPropertyDeleter : 0;}
         ~~~~^
./rr.h:469:14: error: no type named 'NamedPropertyEnumerator' in namespace 'v8'
  inline v8::NamedPropertyEnumerator namedPropertyEnumerator() {return RTEST(enumerator) ? &NamedPropertyEnumerator : 0;}
         ~~~~^
./rr.h:471:14: error: no type named 'IndexedPropertyGetter' in namespace 'v8'
  inline v8::IndexedPropertyGetter indexedPropertyGetter() {return &IndexedPropertyGetter;}
         ~~~~^
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/rafaelporraslucena/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/therubyracer-0.11.4 for inspection.
Results logged to /Users/rafaelporraslucena/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/therubyracer-0.11.4/ext/v8/gem_make.out

Could anyone please help me? I am getting crazy and I cannot/shouldn't bump the gem version.

Much appreciated.

ignisf commented 9 years ago

@rporrasluc I believe your issue is related to https://github.com/cowboyd/libv8/pull/161. It should be fixed in libv8's master branch. You can try it out like this: https://github.com/cowboyd/libv8#using-a-git-version.

rporrasluc commented 9 years ago

Thank you very much @ignisf. The thing is that therubyracer is currently pointing to another libv8 tag, so the error keep happening again and again.

This is what happens if I add libv8 gem to the Gemfile (not added before as we need just therubyracer which requires libv8):

Bundler could not find compatible versions for gem "libv8":
  In Gemfile:
    therubyracer (= 0.11.4) ruby depends on
      libv8 (~> 3.11.8.12) ruby

    libv8 (>= 0) ruby

Thanks for your help, kind regards.

krazyjakee commented 9 years ago

I am suddenly having issues compiling therubyracer. When I install libv8 from the master branch, I can't compile that either.

I am getting the same error as @tian-xiaobo

My ruby version: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14] My bundler version: Bundler version 1.9.4 My V8 version is V8 version 4.1.0.27 [sample shell] My libv8 version is libv8-3.16.14.7-x86_64-darwin-14

Probably unrelated, but my output for gcc -v had Configured with: --prefix=/Library/Developer/CommandLineTools/usr It's working for my colleague who has Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr All other details of that output are identical.

krazyjakee commented 9 years ago

I used the second solution here to fix my problem: http://stackoverflow.com/questions/29586857/unable-to-install-therubyracer-on-clean-install-of-yosemite-and-clean-version-of

ignisf commented 9 years ago

@krazyjakee, yes, the same solution as the one mentioned in https://github.com/cowboyd/therubyracer/issues/338.

rporrasluc commented 9 years ago

@krazyjakee @ignisf Which version of therubyracer your solution refers to? None of these solutions seems to work with therubyracer 0.11.4.

krazyjakee commented 9 years ago

@rporrasluc We are using 0.12.2

Piioo commented 9 years ago

The solution for me was to reinstall the ruby version, after I update my mac os x version.

ruby -e 'puts Gem::Platform.local.inspect' Should get back @version="14" for Yosemite if not reinstall ruby.

see: https://github.com/cowboyd/libv8/issues/169

harjis commented 9 years ago

I had to reinstall ruby aswell. None of the other solutions I found worked for me.

serv commented 9 years ago

@rporrasluc Same problem here.

Reinstall rvm and reinstall rubies didn't work for me.

noahgibbs commented 9 years ago

I have the same issue as @rporrasluc but not as @tian-xiaobo. The solution linked by @krazyjakee doesn't work for that issue (and stack trace), alas.

It kind of looks like a v8 version mismatch, but I'm guessing.

noahgibbs commented 9 years ago

Downgrading to v8 version 3.1.5 from the Homebrew archives worked for me: "brew install v8-315; brew link v8-315 --force".

Not sure if it's advisable, but it worked for me.

(Nope - it installs fine, but then it dies at runtime when dyld can't find the right symbols. Don't do this.)

ignisf commented 9 years ago

@noahgibbs, I believe your issue has been fixed in the master branch of libv8.

@cowboyd, we should release the code in the master branch of libv8.

noahgibbs commented 9 years ago

I get a different error, at least. That's progress :-)

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

/Users/noahgibbs/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -r ./siteconf20150612-39084-bozwy2.rb extconf.rb

creating Makefile HEAD is now at 7ce3fe1... Version 3.16.14 HEAD is now at f7bc250... Make gyp/win32 compatible with upstream ninja. Compiling v8 for x64 Using python 2.7.6 Using compiler: /usr/bin/c++ (clang version 6.1.0) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/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:33: In file included from ../src/heap.h:35: In file included from ../src/incremental-marking.h:33: In file included from ../src/mark-compact.h:32: ../src/spaces.h:896:26: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to true [-Werror,-Wtautological-undefined-compare] bool exists() { return this != NULL && coderange != NULL; } ^~ ~~ ../src/spaces.h:898:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare] if (this == NULL || coderange == NULL) return false; ^~ ~~ 2 errors generated. make[1]: * [/Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o] Error 1 make: * [x64.release] Error 2 /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/ext/libv8/location.rb:36:in block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/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/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/ext/libv8/location.rb:35:ineach' from /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/ext/libv8/location.rb:35:in verify_installation!' from /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/ext/libv8/location.rb:26:ininstall!' 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) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o LIBTOOL-STATIC /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/libpreparser_lib.a CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/preparser/preparser/preparser-process.o LINK(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/preparser CXX(target) /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o

extconf failed, exit code 1

Gem files will remain installed in /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/libv8-299c3e03880f for inspection. Results logged to /Users/noahgibbs/.rvm/gems/ruby-2.0.0-p247/bundler/gems/extensions/x86_64-darwin-14/2.0.0/libv8-299c3e03880f/gem_make.out An error occurred while installing libv8 (3.16.14.8.rc1), and Bundler cannot continue.

noahgibbs commented 9 years ago

Reinstalling a new Ruby 2.2.1 fresh on this machine and trying again doesn't help. So it's not a problem with Ruby being installed on a prior version of Mac OS. Though perhaps RVM is installing a stale binary somehow?

ponny commented 9 years ago

Getting same issue. New mac. Ruby 2.1.6. Switching to 3.1.5 seems to have no effect.

robinbudd commented 9 years ago

Same problem. I wonder if this is a compiler version issue. My gcc is 4.2.1. I'd really like to get this resolved...

bilby91 commented 9 years ago

brew install v8-315; brew link v8-315 --force did the trick for me.

robinbudd commented 9 years ago

I finally did get it to work by downgrading my OSX Command Line Tools: XCode 6.2 for OSX 10.10. Download it here. You will need an apple developer account to access the download.

samithaliyanage commented 9 years ago

I got the same issue as @rporrasluc . i.e. install therubyracer (0.12.2) on Mac OS 10.10.3. Here are the steps I followed and it worked.

I had to change my Gemfile to use specific version of libv8 gem 'libv8', '3.16.14.7'

If you have already installed libv8

gem uninstall libv8

Run this to get darwin version ruby -e 'puts Gem::Platform.local.inspect'

if you get an output like following with darwin version 14 #<Gem::Platform:0x3fd7a5892224 @cpu="universal", @os="darwin", @version="14">

gem fetch libv8 -v 3.16.14.7 --platform x86_64-darwin-14
gem install libv8-3.16.14.7-x86_64-darwin-14.gem
gem install therubyracer

This is the discussion I referred. https://github.com/cowboyd/libv8/issues/169

mplewis commented 9 years ago

@samithaliyanage: Thanks for posting that. Adding the following line alongside my therubyracer dependency worked:

gem 'libv8', '3.16.14.7'
itsNikolay commented 9 years ago

bundle update libv8 solved the problem on my Mac

noahgibbs commented 9 years ago

Yeah, new versions of the libv8 gem solve this.

bilby91 commented 9 years ago

@itsNikolay what version are you running ?

gnitnuj commented 9 years ago

@samithaliyanage's suggestion worked for me prior, but @martinstreicher suggestion's below works for me now (El Capitan, if that matters)

ajeygore commented 9 years ago

I did this.

gem install libv8 -v '3.16.14.3' -- --with-system-v8
brew link --overwrite v8-315 --force
gem install therubyracer -v '0.12.2' -- --with-system-v8

This seems to be working.

juanpaucar commented 9 years ago

What worked for me, was what this comment mentions about downgrading v8

kennym commented 9 years ago

brew install v8-315; brew link v8-315 --force --overwrite did the trick for me. It's such a hassle to do a bundle update knowing that therubyracer will always break. Isn't there a hassle-free alternative?

sunny commented 9 years ago

bundle config build.libv8 --with-system-v8 then bundle update libv8 (went from 3.16.14.3 to 3.16.14.11) solved the problem for me on my Mac.

martinstreicher commented 8 years ago

I did this:

Added gem 'libv8', '3.16.14.7' and gem 'therubyracer' '0.12.2' to my Gemfile.

Ran gem uninstall libv8 therubyracer to remove all versions.

Ran bundle update libv8

I also ran brew doctor, brew update, and brew upgrade before I ran this, but I don't think those steps made any changes of note.

gwintrob commented 8 years ago

@martinstreicher's suggestion worked for me. Thanks!

flov commented 8 years ago

Nothing worked for me, I went nuts and just ended up downgrading therubyracer to 0.11.4

josecoelho commented 8 years ago

@martinstreicher's suggestion worked for me too.

Downgrade from libv8 3.16.14.11 to 3.16.14.7

jasonlynes commented 8 years ago

holy god, @kennym's suggestion worked for me on El Capitän:

brew install homebrew/versions/v8-315
brew link --overwrite v8-315 --force
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-system-v8

edit: fixed version to 3.16.14.13

cowboyd commented 8 years ago

@josecoelho @flov @jasonlynes I believe you want to use the latest release of libv8 3.16.14.13 Please uninstall all other versions of libv8 and then:

gem install libv8 -v libv8 3.16.14.13

jloosfelt commented 8 years ago

+1 for @jasonlynes final solution on El Capitan. Thanks!

cowboyd commented 8 years ago

@jloosfelt as mentioned previously, 3.16.14.13 is compatible with El Capitan .

shyamster commented 8 years ago

After three hours of fighting this, @jasonlynes solution worked for me as well on El Capitan!

cowboyd commented 8 years ago

@shyamster did you try 3.16.14.13?

cowboyd commented 8 years ago

I'm locking this because if

$ CXX=clang gem install libv8 -v 3.16.14.13

or

$ CXX=clang bundle update libv8

does not work, then it should be registered as a separate issue. No further hacks should be required