rubyjs / therubyracer

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

Fails Install OS X El Capitan - 10.11 Beta (15A215h) #359

Closed karlentwistle closed 8 years ago

karlentwistle commented 9 years ago
gem install therubyracer -v '0.12.2'
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    /Users/karl/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150714-54941-u2qv6y.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
checking for main() in -lv8... 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: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: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;}
         ~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [accessor.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/karl/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/therubyracer-0.12.2 for inspection.
Results logged to /Users/karl/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.12.2/gem_make.out
sbenyaala commented 9 years ago

This helped me: http://stackoverflow.com/a/20145328/275058

DeLaGuardo commented 9 years ago
brew tap homebrew/versions
brew install v8-315
brew link --force v8-315
gem install libv8 -- --with-system-v8
gem install therubyracer
karlentwistle commented 9 years ago
brew install v8-315
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
==> Installing v8-315 from homebrew/homebrew-versions
==> Downloading https://github.com/v8/v8/archive/3.15.11.tar.gz
Already downloaded: /Library/Caches/Homebrew/v8-315-3.15.11.tar.gz
==> make dependencies
==> make native -j4 library=shared snapshot=on console=readline
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [/private/tmp/v8-31520150716-53019-4u2nz3/v8-3.15.11/out/native/preparser] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [native] Error 2

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/homebrew/homebrew-versions/issues

Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
bpinto commented 9 years ago

Newest versions of libv8 are already compatibly with el capitan, but therubyracer gem references an old version of libv8.

Reference: https://github.com/cowboyd/libv8/issues/180

ignisf commented 9 years ago

@karlentwistle may I see the output of the gem list libv8 or respectively bundle exec gem list libv8 command on your system?

karlentwistle commented 9 years ago

Sure thing

gem list libv8

*** LOCAL GEMS ***

libv8 (3.16.14.11)
dschmura commented 9 years ago

Any more insights on how to resolve or work around this issue? Thanks,

rmasoni commented 9 years ago

I'm having the same problem.

I tried using only the gem version, only the brew version, tried v8-315, tried letting therubyracer install v8, tried specifying the versions, tried building the gem from the repo… nothing worked.

I'm afraid I'll have to roll back to Yosemite to be able to work again :disappointed:

bpinto commented 9 years ago

@rmasoni I was able to install the gem using v8-315. Did you follow @DeLaGuardo instructions?

rmasoni commented 9 years ago

@bpinto Yes. Then I was able to install via @sbenyaala's link (with apple-gcc42).

Later I tried to run bundle again and it stopped on libv8 because it's requesting the 3.16.14.7 version (I have 3.16.14.11 installed). This is a nightmare — but it's on my end now.

michaelglass commented 9 years ago

here's a binary I built while we wait for 3.16.14.12:

https://github.com/NoRedInk/libv8/blob/2570d0aa3784aa8ab787ec848930886aa25a36ae/pkg/libv8-3.16.14.11-x86_64-darwin-15.gem

this worked for me (while seemingly nothing else did)

$ gem install libv8-3.16.14.11-x86_64-darwin-15.gem
$ gem install therubyracer
dschmura commented 9 years ago

The @DeLaGuardo instructions? ended up working for me, but not directly. I had to uninstall all libv8 && v8 (brew and gem). Unfortunately, it was one of those 'try a billion paths and stop when one worked' sort of deals, and I didn't have a great record of what ended up working.

I am sorry, and a bit ashamed...

Still...thank you @DeLaGuardo for providing the path towards moving forward!! Dave

srpouyet commented 9 years ago

@DeLaGuardo instructions mostly worked for me (with El Capitan Public Beta 3, Xcode 7 Beta, Command Line Tools 7.0 beta), but instead of gem install therubyracer I had to do gem install therubyracer -- --with-system-v8. :tada:

dschmura commented 9 years ago

So, I got a second bite at the apple with the release of Ruby 2.2.3. I installed 2.2.3 using rbenv

 rbenv install 2.2.3 

Then I switched the 'local' version of my ruby to use the new 2.2.3 install

 rbenv local 2.2.3 

Then installed bundler

 gem install bundler 

Then I using the binary @michaelglass built. Not that once you download the gem, you need to either run the gem install command from the directory that you downloaded it from or pass the path to the downloaded file.

 gem install libv8-3.16.14.11-x86_64-darwin-15.gem 
 gem install therubyracer

From here I was able to do a regular bundle install for my projects and everything worked splendidly. Thank you @michaelglass! Nice work!

thehappycoder commented 8 years ago

@DeLaGuardo Can you share the tar.gz file with me? I can't download it. https://github.com/Homebrew/homebrew/issues/44496

jszmajda commented 8 years ago

sigh Having trouble with El Capitan also. Here's a gist with the trouble, any ideas? https://gist.github.com/joshsz/300ca553bf3e4fe3ff2d

(The TL;DR is /Users/josh/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext/parser.bundle: [BUG] Segmentation fault)

cowboyd commented 8 years ago

@joshsz I noticed that the segmentation fault was in the JSON gem, not libv8 or the rubyracer.

Also, We recently released a binary that should be compatible with El Capitan. What happens if you remove all --with-system-v8 flags from your bundle / gem config.

$ gem uninstall libv8
$ bundle update libv8
louh commented 8 years ago

Thanks so much, @cowboyd. Just found this thread when running into this problem, and the updated libv8 works just fine. (Ruby 2.2.3, fresh install of El Capitan)

jszmajda commented 8 years ago

@cowboyd Awesome, that seems to have fixed it, thanks!

ferdly commented 8 years ago

@cowboyd Thanks from me too!

In hind sight I think trying to learn Ruby right after upgrading to El Capitan might have caused me a little bit of consternation (massive understatement!) -- does anyone know of a resource for reading about OSX updates -- especially concerning local development environments -- that I (we) may read to help decide whether the update is "worth it". I have a friend I respect greatly that never upgrades his OSX... okay, but this can't be good long-term? TIA

Again, Thanks to @cowboyd !!

itssasanka commented 8 years ago

This helped me : http://stackoverflow.com/a/20145328/1981328

ambirdsall commented 8 years ago

I wasn't able to get any of the above solutions to work (or rather, everything I could get to work would have required the rest of my team to rebundle). After switching from rbenv to RVM, however, bundle install ran without a hitch.

shayneoAtNorwood commented 8 years ago

bump. Same problem. This gem is kind of broken on macs at this stage. Fresh OS X install and kaboom.

shayneoAtNorwood commented 8 years ago

@itssasank , this won't work on El Capitan. the /usr/bin is locked at the kernel level so symlinks are not allowed.

danielwiedeback commented 8 years ago

Tried to install therubyracer with El Capitan. @DeLaGuardo's instructions fixed it for me with one tweak:

$ bundle config build.libv8 --with-system-v8
$ bundle install
afiedler commented 8 years ago

This seems to be working for me, if you can change your Gemfile.lock on your project.

Change libv8 in Gemfile.lock to libv8 (3.16.14.11)

I also did brew unlink for any system V8s that I installed.

Then run this:

gem uninstall therubyracer
gem uninstall libv8
bundle install
andywenk commented 8 years ago

simply changing the Gemfile.lock as @afiedler proposed worked while using a older project with an older libv8 version ... thanks

ignisf commented 8 years ago

Install issues on darwin 14 and 15 should be fixed now (by the release of libv8 3.16.14.14 and 3.16.14.15), I'm going to lock this issue to encourage opening new issues.