无法在OS X Mavericks上安装libv8 gem

时间:2014-07-02 06:50:10

标签: ruby gem osx-mavericks

我在OS X Mavericks(10.9.4)上安装Ruby libv8 gem时遇到问题,我收到以下错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-2.0.0-p451/bin/ruby extconf.rb
creating Makefile
/usr/local/rvm/gems/ruby-2.0.0-p451/gems/libv8-3.11.8.13/ext/libv8/compiler.rb:30: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.0.0-p451/bin in PATH, mode 040777
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++
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable]
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);

我尝试告诉clang当使用以下内容时有一个未使用的常量时不会出错,但无效但结果是相同的:

ARCHFLAGS=-Wno-error=unused-const-variable gem install libv8 -v '3.11.8.13'

我缺少什么命令行选项?

由于

1 个答案:

答案 0 :(得分:8)

我的机器上遇到了同样的问题。使用--with-system-v8标志解决了问题。关于此标志的完整文档here