Instalacja libv8 gem na OS X 10.9+

Próbuję zainstalować libv8 3.16.14.3, ale pojawia się błąd na OSX Mavericks przy użyciu najnowszej stabilnej RVM i ruby-1.9.3-p125.

Jest to wynik uruchomienia polecenia 'Gem install libv8':

~/src(branch:master) » gem install libv8
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
  ERROR: Failed to build gem native extension.

    /Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
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
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make[1]: *** [/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a] Error 1
make: *** [x64.release] Error 2
/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/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/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
  from /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
  from /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/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_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
  LIBTOOL-STATIC /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a


Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/gem_make.out
Author: Gaurav Agarwal, 2013-10-25

16 answers

Wynika to z faktu, że OS X 10.9+ używa wersji 4.8 GCC. Nie jest to oficjalnie obsługiwane w starszych wersjach libv8, jak wspomniano w pull request (https://github.com/cowboyd/libv8/pull/95). spróbuj wrzucić wersję libv8 do pliku Gemfile (lub) A bundle update powinno wystarczyć. Mam nadzieję, że to pomoże.

Z libv8 README

Bring your own V8

Ponieważ libv8 jest interfejsem dla silnika V8 używanego przez therubyracer, ty może być konieczne użycie libv8, nawet jeśli masz już zainstalowaną wersję V8. Jeśli chcesz użyć własnej instalacji V8, zamiast budować ją dla siebie, użyj opcji --with-system-v8.

Używanie RubyGems:

Gem install libv8 [- V YOUR_VERSION] -- -- with-system-v8

Używanie Bundlera (w Twoim Gemfile):

Bundle Config build.libv8 --with-system-v8

Pamiętaj, że jeśli zamierzasz uruchomić własną V8, musisz zainstalować zarówno V8, jak i jego nagłówki (Znalezione w libv8-dev dla dystrybucji Debiana).

Bring your own compiler

Możesz określić kompilator, ustawiając zmienną środowiskową CXX przed kompilacją lub dodając opcję --with-cxx= do konfiguracji pakietu:

Bundle Config build.libv8 --with-cxx=clang++

Edit:

Jeśli problem jest spowodowany przez therubyracer, spróbuj wykonać następujące czynności zgodnie z sugestią rider_on_rails tutaj :

Gem uninstall libv8

Gem install therubyracer - V YOUR_RUBY_RACER_VERSION

Gem install libv8 - V YOUR_VERSION -- -- with-system-v8

 418
Author: Gaurav Agarwal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 12:26:36

Możesz zainstalować tę wersję na Mavericks:

gem install libv8 -v 3.11.8.17 -- --with-system-v8

Mogę potwierdzić, że działa to z rbenv i ruby 1.9.3p448

 205
Author: Oliver Shaw,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-10-29 18:55:40

El Capitan rozwiązanie dla mnie:

$ brew install v8
$ gem install libv8 -v REQUIRED_LIBV8_VERSION -- --with-system-v8

Gdzie REQUIRED_LIBV8_VERSION dla mnie było 3.16.14.7, ale musisz sprawdzić, który jest potrzebny w Twoim pakiecie (ten był dla rails 4.2.5)

Może być również konieczne uruchomienie powyższych poleceń jako superużytkownik (jeśli Twoje klejnoty i biblioteki systemowe są globalne)

 32
Author: Evgenia Manolova,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-23 21:30:17

Kiedy spróbowałem zaakceptowanej odpowiedzi, libv8 zainstalowałby się pomyślnie z gem install libv8, ale bundle install nie powiedzie się na libv8. Myślę, że bundle install próbował zainstalować inną wersję libv8. Udało mi się znaleźć rozwiązanie, które zadziałało dla mnie.

Potrzebowałem libv8, ponieważ therubyracer od tego zależy. Aby go zainstalować, zauważyłem wersję, która nie instalowała się w dzienniku gem_make.out dla therubyracer. (Ścieżka do dziennika gem_make.out będzie znajdować się w wiadomości o błędzie.) W moim przypadku było to 3.16.14.7. (Ta wersja prawdopodobnie zmieni się z czasem, w przypadku, gdy czytasz to za trzy lata.) Wtedy zrobiłem to:

gem install libv8 -v 3.16.14.7 -- --with-v8-lib

Co pozwoliło na działanie:

gem install therubyracer

Co pozwoliło mi ukończyć Moje bundle install.

To działało dla mnie na OSX Yosemite.

 14
Author: Steven Hirlston,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-10-20 00:43:36

Https://github.com/cowboyd/therubyracer/issues/339

Rozwiązanie Jasonlynesa znalezione na tym linku zrobiło dla mnie sztuczkę. Wszystko inne nie zadziałało.

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
 6
Author: Stefanos.Ioannou,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-01 15:16:55

Spróbuj z tym, co podsumowałem w tym pytaniu: "gem install therubyracer-v '0.10.2 '" na osx mavericks nie instaluje

It worked for me (OS X)

 3
Author: damianmr,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 12:34:54

Miałem ten sam problem, gdy uaktualniłem z OSX Mountain Lion do OSX Mavericks. Zaakceptowana odpowiedź działała dla libv8, ale nie wtedy, gdy poszedłem do bundle install therubyracer gem.

Aktualizacja z ruby-1.8.7-p354 do ruby-1.8.7-375 załatwiła mi sprawę. libv8 (3.16.14.3-x86_64-darwin-13) i gems therubyracer (0.12.0) zainstalowane bez problemu.

Zakładając, że używasz rbenv:

rbenv versions
  system
  * 1.8.7-p354
  2.0.0-rc2

rbenv uninstall 1.8.7-p354
rbenv install 1.8.7-p375

rbenv versions
  system
  * 1.8.7-p375
  2.0.0-rc2

bundle install
 1
Author: nelsonenzo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-04-05 03:03:31

To mi się udało:

Spróbuj zainstalować ten wstępnie skompilowany klejnot:

Https://dl.dropboxusercontent.com/u/7919548/gems/libv8/libv8-3.11.8.17-x86_64-darwin-13.gem (sha1: 5ce07aaf4085fff5a5e10fe018fd6b22021bef3b)

Lub jeśli wolisz budować własne:

  git clone https://github.com/cowboyd/libv8.git
  cd libv8
  git checkout 3.11
  bundle install
  bundle exec rake clean build binary
  gem install pkg/libv8-3.11.8.17-x86_64-darwin-13.gem

Źródło: https://github.com/cowboyd/libv8/issues/107

Podziękowania dla Felixa Bünemanna za naprawę!

 1
Author: Tilo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-14 22:50:03

Możesz spróbować ręcznie skompilować i zainstalować gem za pomocą metody wymienionej na stronie github libv8.

 0
Author: RonanOD,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-10-28 16:18:26

W MAC-Yosemite ze środowiskiem RVM i wersją ruby-2.1.1

gem install libv8 -v 3.16.14.3 -- --with-v8-lib gem install therubyracer

Działa przy pomocy powyższego polecenia, może to potwierdzić.

 0
Author: Kishore Mohan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-05-10 12:41:57

To, co naprawdę działało dla mnie, to aktualizacja Rubiego do 2.2.0, usunięcie Gemfile.zamocować i połączyć ponownie.

Zadziałało jak czar!

 0
Author: tomascharad,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-08-13 12:52:58

To mi się udało.

Zastąp 3.16.14.7 swoją wersją.

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

bundle install
gem uninstall libv8 -v '3.16.14.7' -- --with-system-v8

brew install homebrew/dupes/apple-gcc42

export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2

bundle install
 0
Author: Arian Faurtosh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-10-11 05:58:43

Miałem do czynienia z podobnym problemem na El Cap. Oto co zrobiłem.

brew tap homebrew/dupes
brew install apple-gcc42

I wtedy,

export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2

Wreszcie,

brew uninstall v8
gem install libv8 -v 3.11.8.17 -- --with-system-v8
 0
Author: raincrash,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-01-13 11:38:17

Próbowałem wielu rozwiązań opisanych w poprzednich odpowiedziach, ale okazało się, że uruchomiony pakiet (aby zainstalować inne, brakujące klejnoty) będzie próbował ponownie skompilować libv8 (mimo że zainstalowałem go z powodzeniem używając --with-system-v8) i tym samym ucierpi na tym samym problemie.

W końcu odkryłem, że usunięcie klejnotu libv8, pobranie pliku klejnotu z rubygems, a następnie ręczne zainstalowanie pliku .gem z flagą --with-system-v8 zadziałało na mnie.

Tzn.

gem uninstall libv8
gem fetch libv8 -v LIBV8_VERSION
gem install libv8-LIBV_VERSION.gem -- --with-system-v8
bundle

Dzięki Gaurav Agarwal ' s answer for leading me down the right path!

 0
Author: XtraSimplicity,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 12:10:47

Używałem wersji beta Xcode do innego projektu i zapomniałem. Przełącz z powrotem za pomocą xcode-select. Coś w stylu:

sudo xcode-select --switch /Applications/Xcode.app/
 0
Author: huwr,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-02-21 02:57:15

Usuń z Gemfile:

Gem 'therubyracer',: platforms =>: ruby

 -6
Author: Roberto Capelo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-08-12 02:12:46