mac 上安装 therubyracer 0.12.2 依赖于 libv8 3.16.14.13 安装日志如下: Building native extensions. This could take a while... ERROR: Error installing therubyracer: ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.2/ext/v8 /usr/local/opt/ruby/bin/ruby -r ./siteconf20160401-35470-1bzsbrk.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
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/therubyracer-0.12.2/mkmf.log
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.2/ext/v8 make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.2/ext/v8
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:360:33: error: use of undeclared identifier 'nullptr'
V8_INLINE MaybeLocal() : val_(nullptr) {}
^
/usr/local/include/v8.h:367:51: error: use of undeclared identifier 'nullptr'
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
^
/usr/local/include/v8.h:371:29: error: use of undeclared identifier 'nullptr'
out->val_ = IsEmpty() ? nullptr : this->val_;
^
/usr/local/include/v8.h:437:50: error: use of undeclared identifier 'nullptr'
bool IsFirstPass() const { return callback_ != nullptr; }
^
/usr/local/include/v8.h:808:42: error: use of undeclared identifier 'nullptr'
V8_INLINE Global() : PersistentBase(nullptr) {}
^
/usr/local/include/v8.h:833:18: error: use of undeclared identifier 'nullptr'
other.val_ = nullptr;
^
/usr/local/include/v8.h:845:18: error: use of undeclared identifier 'nullptr'
rhs.val_ = nullptr;
^
/usr/local/include/v8.h:1110:52: error: use of undeclared identifier 'nullptr'
ScriptOrigin* origin = nullptr));
^
/usr/local/include/v8.h:1113:30: error: use of undeclared identifier 'nullptr'
ScriptOrigin* origin = nullptr);
^
/usr/local/include/v8.h:3242:36: error: use of undeclared identifier 'nullptr'
return NewInstance(context, 0, nullptr);
^
/usr/local/include/v8.h:4457:57: error: use of undeclared identifier 'nullptr'
experimental::FastAccessorBuilder* fast_handler = nullptr,
^
/usr/local/include/v8.h:4473:57: error: use of undeclared identifier 'nullptr'
experimental::FastAccessorBuilder* fast_handler = nullptr);
^
/usr/local/include/v8.h:7292:27: error: use of undeclared identifier 'nullptr'
if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty();
^
In file included from accessor.cc:1:
./rr.h:358:39: error: no member named 'ScriptData' in namespace 'v8'
class ScriptData : public Pointerv8::ScriptData {
~~^
./rr.h:358:51: error: expected class name
class ScriptData : public Pointerv8::ScriptData {
^
./rr.h:360:21: error: no type named 'ScriptData' in namespace 'v8'; did you mean simply 'ScriptData'?
inline ScriptData(v8::ScriptData* d) : Pointerv8::ScriptData(d) {};
^~~~~~~~~~~~
ScriptData
./rr.h:358:7: note: 'ScriptData' declared here
class ScriptData : public Pointerv8::ScriptData {
^
./rr.h:360:54: error: no member named 'ScriptData' in namespace 'v8'
inline ScriptData(v8::ScriptData* d) : Pointerv8::ScriptData(d) {};
~~~~^
./rr.h:360:65: error: expected class member or base class name
inline ScriptData(v8::ScriptData* d) : Pointerv8::ScriptData(d) {};
^
./rr.h:360:65: error: expected '{' or ','
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 /usr/local/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.2 for inspection. Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/therubyracer-0.12.2/gem_make.out