如何在新的Mountain Lion安装上安装libv8 ruby​​ gem?

我一直在讨厌这个问题.我在几个相关的帖子中都遵循了建议,但无济于事.

我从全新安装的Mountain Lion开始,安装了Command Line Tools,并根据我发现的一些其他帖子成功安装了Ruby 1.8.7,这些帖子通过Homebrew安装gcc-4.2并在/ usr /中添加一个符号链接斌/ GCC-4.2.

但是,现在我无法成功安装libv8.以下错误是我已经从现有的建议中得到的.

任何额外的输入?

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/Eric/.rbenv/versions/1.8.7-p352/bin/ruby extconf.rb 
creating Makefile
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Traceback (most recent call last):
  File "build/gyp/gyp",line 18,in <module>
    sys.exit(gyp.main(sys.argv[1:]))
  File "build/gyp/pylib/gyp/__init__.py",line 480,in main
    generator.GenerateOutput(flat_list,targets,data,params)
  File "build/gyp/pylib/gyp/generator/make.py",line 2085,in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "build/gyp/pylib/gyp/generator/make.py",line 756,in Write
    self.xcode_settings,self.Absolutify,self.Pchify))
  File "build/gyp/pylib/gyp/generator/make.py",line 1132,in WriteSources
    cflags = self.xcode_settings.GetCflags(configname)
  File "build/gyp/pylib/gyp/xcode_emulation.py",line 258,in GetCflags
    sdk_root = self._SdkPath()
  File "build/gyp/pylib/gyp/xcode_emulation.py",line 247,in _SdkPath
    return os.path.join(self._GetSdkBaseDir(),'%s.sdk' % sdk_root)
  File "build/gyp/pylib/gyp/xcode_emulation.py",line 233,in _GetSdkBaseDir
    raise Exception('Error %d running xcode-select' % job.returncode)
Exception: Error 2 running xcode-select
make: *** [out/Makefile.x64] Error 1
Using compiler: g++
GYP_GENERATORS=make \
    build/gyp/gyp --generator-output="out" build/all.gyp \
                  -Ibuild/standalone.gypi --depth=. \
                  -Dv8_target_arch=x64 \
                  -S.x64 -Dhost_arch=x64
xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>,or see the xcode-select manpage (man xcode-select) for further information.



Gem files will remain installed in /Users/Eric/Development/par8o/vendor/bundle/ruby/1.8/gems/libv8-3.11.8.3 for inspection.
Results logged to /Users/Eric/Development/par8o/vendor/bundle/ruby/1.8/gems/libv8-3.11.8.3/ext/libv8/gem_make.out
An error occured while installing libv8 (3.11.8.3),and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.3'` succeeds before bundling.

解决方法

这笔交易是ruby1.8.7.可能你需要这个宝石来运行therubyracer.要完成这项工作,您需要安装therubyracer gem如下:
RUBYOPT=-rrubygems gem install therubyracer

这将安装therubyracer和libv8宝石.

来源:http://coderwall.com/p/y1djxq

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...