¿Instalar gema therubyracer -v '0.11.4'?

Estoy casi loco de instalartherubyracer. Sé que hay muchas personas que tienen el mismo problema conmigo, y también había visto estos problemas, sin embargo, es demasiado complicado para mí porque diferentes situaciones tienen diferentes soluciones. Y de hecho, no ha habido una buena manera de resolver el problema. Mi problema es similar aestay hay undiscusión al respecto, sin embargo todavía no tenemos una conclusión.

A pesar de esto,esta es una buena pregunta hecha porChris S, pero no es un buen resultado.

① Aquí hay algunas notas sobre mi problema:

1.ruby 2.2.1p85 (2015-02-26 revisión 49769) [x86_64-darwin15]

2.libv8 3.11.8.17 con extensiones nativas

② OS X El Capitan, 10.11

③ Aquí están los mensajes de error:

ERROR:  Error installing therubyracer:
ERROR: Failed to build gem native extension.

/Users/hufeipeng/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20151026-41811-14t2l9a.rb extconf.rb

checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... 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:353:33: error: use of undeclared identifier 'nullptr'
V8_INLINE MaybeLocal() : val_(nullptr) {}
                            ^
/usr/local/include/v8.h:360:51: error: use of undeclared identifier 'nullptr'
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
                                              ^
/usr/local/include/v8.h:364:29: error: use of undeclared identifier 'nullptr'
out->val_ = IsEmpty() ? nullptr : this->val_;
                        ^
/usr/local/include/v8.h:430:50: error: use of undeclared identifier 'nullptr'
bool IsFirstPass() const { return callback_ != nullptr; }
                                             ^
/usr/local/include/v8.h:790:42: error: use of undeclared identifier 'nullptr'
V8_INLINE Global() : PersistentBase<T>(nullptr) {}
                                     ^
/usr/local/include/v8.h:815:18: error: use of undeclared identifier 'nullptr'
other.val_ = nullptr;
             ^
/usr/local/include/v8.h:827:18: error: use of undeclared identifier 'nullptr'
rhs.val_ = nullptr;
             ^
/usr/local/include/v8.h:1092:52: error: use of undeclared identifier 'nullptr'
ScriptOrigin* origin = nullptr));
                         ^
/usr/local/include/v8config.h:347:48: note: expanded from macro 'V8_DEPRECATE_SOON'
#define V8_DEPRECATE_SOON(message, declarator) declarator
                                           ^
In file included from accessor.cc:1:
In file included from ./rr.h:4:
/usr/local/include/v8.h:1095:30: error: use of undeclared identifier 'nullptr'
ScriptOrigin* origin = nullptr);
                         ^
/usr/local/include/v8.h:2283:42: error: 'v8::NewStringType' is not a class, namespace, or scoped enumeration
kNormalString = static_cast<int>(v8::NewStringType::kNormal),
                                     ^
/usr/local/include/v8.h:2284:48: error: 'v8::NewStringType' is not a class, namespace, or scoped enumeration
kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
                                           ^
/usr/local/include/v8.h:3205:36: error: use of undeclared identifier 'nullptr'
return NewInstance(context, 0, nullptr);
                               ^
/usr/local/include/v8.h:3434:38: error: 'v8::ArrayBufferCreationMode' is not a class, namespace, or scoped enumeration
ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
                                 ^
/usr/local/include/v8.h:3797:38: error: 'v8::ArrayBufferCreationMode' is not a class, namespace, or scoped enumeration
ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
                                 ^
/usr/local/include/v8.h:4457:36: error: 'v8::PropertyHandlerFlags' is not a class, namespace, or scoped enumeration
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
                             ^
/usr/local/include/v8.h:4485:36: error: 'v8::PropertyHandlerFlags' is not a class, namespace, or scoped enumeration
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
                             ^
/usr/local/include/v8.h:7151:27: error: use of undeclared identifier 'nullptr'
if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty();
                        ^
/usr/local/include/v8config.h:353:54: note: expanded from macro 'V8_UNLIKELY'
# define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
                                                 ^
In file included from accessor.cc:1:
In file included from ./rr.h:4:
/usr/local/include/v8.h:7596:46: error: 'v8::NewStringType' is not a class, namespace, or scoped enumeration
Set(v8::String::NewFromUtf8(isolate, name, NewStringType::kNormal)
                                         ^
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> {
                              ~~~~^
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/*/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/therubyracer-0.11.4 for inspection.
Results logged to
/Users/*/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.11.4/gem_make.out

¡Ayuda!

Bueno, en primer lugar siento mucho volver a editar el problema, estoy demasiado ocupado sin tiempo para notar los comentarios que sus muchachos respondieron por mí. Y, aquí, estoy muy agradecido de que @Javid Jamae me brinde una excelente manera de resolver el problema, aunque todavía hay algunos asuntos pequeños que resolver, pero está bien que solo necesitemos los errores para ayudarnos a encontrar el respuesta final. La siguiente es la consola después de haber probado @Javid Jamae way,

Primero, no he instaladogcc conelaborar cerveza antes, así que lo instalé con brew y la versión es la última5.2.0 (/usr/local/Cellar/gcc/5.2.0) Aquí están los detalles:

➜  /Users/xxx  >brew install gcc
==> Installing dependencies for gcc: gmp, mpfr, libmpc, isl
==> Installing gcc dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.0.0a.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gmp-6.0.0a.el_capitan.bottle.tar.gz
  /usr/local/Cellar/gmp/6.0.0a: 15 files, 3.2M
==> Installing gcc dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-3.1.3.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mpfr-3.1.3.el_capitan.bottle.tar.gz
  /usr/local/Cellar/mpfr/3.1.3: 24 files, 3.6M
==> Installing gcc dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.0.3.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libmpc-1.0.3.el_capitan.bottle.tar.gz
  /usr/local/Cellar/libmpc/1.0.3: 10 files, 380K
==> Installing gcc dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.14.1.el_capitan.bottle.3.tar.gz
######################################################################## 100.0%
==> Pouring isl-0.14.1.el_capitan.bottle.3.tar.gz
  /usr/local/Cellar/isl/0.14.1: 68 files, 3.2M
==> Installing gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-5.2.0.el_capitan.bottle.2.tar.gz
##################### 29.8%
curl: (56) SSLRead() return error -9806
Error: Failed to download resource "gcc"
Download failed: https://homebrew.bintray.com/bottles/gcc-5.2.0.el_capitan.bottle.2.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
==> Downloading from http://mirrors.ustc.edu.cn/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
######################################################################## 100.0%
==> Patching
patching file gcc/jit/Make-lang.in
patching file gcc/jit/jit-playback.c
Hunk #1 succeeded at 2459 with fuzz 2 (offset 43 lines).
==> ../configure --build=x86_64-apple-darwin15.0.0 --prefix=/usr/local/Cellar/gcc/5.2.0 --libdir=/usr/local/Cel
==> make bootstrap
==> make install
==> Caveats
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to brew reinstall gcc --without-multilib
==> Summary
  /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M, built in 52.4 minutes

¡Parece que la instalación está bien! Y luego, había desinstalado eltherubyracer ylibv8 con gema Sin embargo, cuando se trata de instalar eltherubyracer (No señalé la versión cuando la instalé o enGemfile, y elhaz recuérdame la versión0.12.2 es necesario), viene el error:

➜  /Users/xxx/Documents/workspace/xxx git:(master) ✗ >gem install therubyracer -v '0.12.2'
Fetching: libv8-3.16.14.13.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/xxx/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20151230-50968-1yqguip.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.10
Using compiler: /usr/bin/c++ (clang version 6.1.0)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file:
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/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 && code_range_ != 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 || code_range_ == NULL) return false;
    ^~~~    ~~~~
2 errors generated.
make[1]: ***
[/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o]
Error 1
make: *** [x64.release] Error 2
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/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/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:35:in `each'
from
/Uses/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:35:in `verify_installation!'
from
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/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 -Dwerror=''
CXX(target)
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
CXX(target)
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
CXX(target)
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
.................. (the follow error messages are similar to above)

Bueno, me pregunto si sigue siendo el problema delibv8! Al principio, creo que tal vez sea el problema de la versión detherubyracer, así que intenté instalar la versión0.12.0Desafortunadamente, hay los mismos errores. Hay algo extraño, quiero decir ellibv8 se instala con eltherubyracer en mi caso (mira eso de los mensajes de error), pero eres diferente conmigo. Como su sugerencia marcó, instale ellibv8 después de haber instalado eltherubyracer¿Por qué son diferentes? Tal vez se relacione con mirubí configuración del entorno, aquí publiqué miGemfile configuración:

gem 'rails', '4.1.6'
gem 'mysql2', '0.3.18'
gem 'sass-rails', '~> 4.0.3'
gem 'bootstrap-sass', '~> 3.3.4'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'

gem 'therubyracer', platforms: :ruby

gem 'jquery-rails','3.1.2'
gem 'jquery-ui-rails', '4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'log4r', '1.1.9'
gem 'devise','3.4.1'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.6.0'
gem 'thin','1.6.2'
gem 'kaminari', '0.16.1'
gem 'factory_girl_rails'
gem 'httparty'
gem "select2-rails",'3.5.9.3'

group :test, :development do
    gem 'net-ssh', '2.7.0'
    gem 'capistrano', '2.12.0'
    gem 'capistrano-rbenv', '1.0.1'
    gem 'spring'
    gem 'magic_encoding', '0.0.2'
    gem 'rspec-rails', '3.2.0'
end

Respuestas a la pregunta(3)

Su respuesta a la pregunta