Instalación de libv8 gem en OS X 10.9+


Estoy intentando instalar libv8 3.16.14.3 pero obteniendo un error en OSX Mavericks usando el último rvm estable y ruby-1.9.3-p125.

Este es el resultado de ejecutar el comando '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

Esto se debe al hecho de que OS X 10.9+ está utilizando la versión 4.8 de GCC. Esto no se admite oficialmente en versiones anteriores de libv8 como se menciona en la solicitud de extracción ( https://github.com/cowboyd/libv8/pull/95 ). Por favor, intente subir la versión de libv8 en su Gemfile (o) a bundle update debería ser suficiente. Espero que esto ayude.

Del README de libv8

Trae tu propio V8

Debido a que libv8 es la interfaz para el motor V8 utilizado por therubyracer, usted es posible que necesite usar libv8, incluso si ya tiene V8 instalado. Si desea utilizar su propia instalación V8, en lugar de tener que construir para usted, utilice la opción --with-system-v8.

Usando RubyGems:

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

Usando Bundler (en tu Gemfile):

Compilación de configuración del paquete.libv8 with with-system-v8

Tenga en cuenta que si tiene la intención de ejecutar su propio V8, debe instalar tanto V8 y su encabezados (encontrados en libv8-dev para distribuciones Debian).

Trae tu propio compilador

Puede especificar un compilador de su elección configurando la variable de entorno CXX antes de la compilación, o agregando la opción --with-cxx= a la configuración del paquete:

Compilación de configuración del paquete.libv8 with with-cxx = clang++

Editar:

Si este problema es provocado por therubyracer, intente lo siguiente como sugiere rider_on_rails aquí :

Gema desinstalar libv8

Gem install therubyracer-v YOUR_RUBY_RACER_VERSION

Gem install libv8-v YOUR_VERSION with 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:26:36

En realidad puedes instalar esa versión en Mavericks:

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

Puedo confirmar que esto funciona con rbenv y 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-29 18:55:40

El Capitan Solución para mí:

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

Donde REQUIRED_LIBV8_VERSION para mí estaba 3.16.14.7, pero debes verificar cuál es el que necesitas en tu paquete (este era el de rails 4.2.5)

Es posible que también necesite ejecutar los comandos anteriores como superusuario (si sus gemas y bibliotecas del sistema son globales)

 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-23 21:30:17

Cuando probé la respuesta aceptada, libv8 se instalaría correctamente con gem install libv8, pero bundle install fallaría en libv8. Creo que bundle install estaba tratando de instalar una versión diferente de libv8. Pude encontrar una solución que funcionó para mí.

Necesitaba libv8 porque therubyracer depende de ello. Para que se instalara, noté la versión que no se instalaba en el registro gem_make.out de therubyracer. (La ruta para el registro gem_make.out estará en el mensaje de error. En mi caso fue 3.16.14.7. (Esta versión probablemente cambiará con el tiempo, en caso de que estés leyendo esto dentro de tres años.) Entonces hice esto:

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

Lo que permitió que esto funcionara:

gem install therubyracer

Que me permitió completar mi bundle install.

Esto funcionó para mí en 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-20 00:43:36

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

La solución de Jasonlynes encontrada en ese enlace hizo el truco para mí. cualquier otra cosa no funcionó.

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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-01 15:16:55

Prueba con lo que resumí en esta pregunta: "gem install therubyracer-v '0.10.2' " en osx mavericks no instalando

Funcionó para mí (OS X Mavericks)

 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:34:54

Tuve este mismo problema cuando actualicé de OSX Mountain Lion a OSX Mavericks. La respuesta aceptada funcionó para libv8, pero no cuando fui a bundle install therubyracer gem.

Actualización de ruby 1.8.7-p354 a ruby 1.8.7-375 hizo el truco para mí. libv8 (3.16.14.3-x86_64-darwin-13) y las gemas therubyracer (0.12.0) instaladas sin problema.

Asumiendo que usa 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-04-05 03:03:31

Esto funcionó bien para mí:

Intenta instalar esta gema precompilada:

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

O si prefieres construir el tuyo propio:

  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

Fuente: https://github.com/cowboyd/libv8/issues/107

Gracias a Felix Bünemann por la solución!

 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-14 22:50:03

Puede intentar compilar e instalar manualmente la gema a través del método mencionado en el sitio libv8 github.

 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-28 16:18:26

En MAC-Yosemite con entorno RVM y la versión ruby-2.1.1

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

Funciona con la ayuda del comando anterior, puede confirmar esto.

 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-10 12:41:57

Lo que realmente funcionó para mí fue actualizar ruby a 2.2.0, eliminando Gemfile.bloquear y agrupar de nuevo.

Funcionó como un encanto!

 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-13 12:52:58

Esto es lo que funcionó para mí.

Reemplaza 3.16.14.7 con tu versión.

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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-10-11 05:58:43

Me he enfrentado a un problema similar en El Cap. Esto es lo que hice.

brew tap homebrew/dupes
brew install apple-gcc42

Y luego,

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

Finalmente,

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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-13 11:38:17

Probé una serie de soluciones descritas en respuestas anteriores, pero descubrí que ejecutar bundle (para instalar otras gemas faltantes) intentaría volver a compilar libv8 (a pesar de haberlo instalado con éxito usando --with-system-v8) y, por lo tanto, sufriría el mismo problema.

Finalmente, descubrí que eliminar la gema libv8, buscar el archivo de gema de rubygems y luego instalar manualmente el archivo .gem con la bandera --with-system-v8 funcionó para mí.

Es decir,

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

Gracias a Gaurav ¡La respuesta de Agarwal por guiarme por el camino correcto!

 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:10:47

Estaba usando una versión beta de Xcode para otro proyecto y lo había olvidado. Vuelva a cambiar con xcode-select. Algo como:

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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-21 02:57:15

Eliminar del 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/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-12 02:12:46