簡體   English   中英

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

[英]How do I install the libv8 ruby gem on a fresh Mountain Lion install?

我一直在討厭這個問題。 我在幾個相關的帖子中都遵循了建議,但無濟於事。

我從一個全新的Mountain Lion安裝開始,安裝了命令行工具,並根據我發現通過Homebrew安裝gcc-4.2並在/ usr /中添加符號鏈接的其他一些帖子成功安裝了Ruby 1.8.7斌/ 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.

這筆交易是紅寶石1.8.7。 可能你需要這個寶石來運行therubyracer。 要完成這項工作,您需要安裝therubyracer gem如下:

RUBYOPT=-rrubygems gem install therubyracer

這將安裝therubyracer和libv8寶石。

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

在我的情況下,由於libtool問題,編譯失敗。 錯誤是libtool: unrecognized option '-static'安裝libv8 gem時libtool: unrecognized option '-static'

問題是,我的macports-Installation有一個明顯不起作用的libtool。 並且$PATH中的macports-Directory在常規目錄之前調用了錯誤的libtool。

從PATH-Environmentvariable中刪除macports-Directories就可以了:使用了XCodelibtool ,一切都很順利。

我有這個問題,並在這里找到了解決方案

簡而言之,自己安裝v8 - 如果你有自釀啤酒,你可以運行

brew install v8

然后在安裝時使用系統v8

gem install libv8 -- --with-system-v8

我在OS X 10.7.5上遇到此問題后,以下Gemfile條目對我有用:

gem "libv8", '3.11.8.13'

> ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2]

使用上面的RUBYOPT = -rrubygems建議對我有用,但我必須首先卸載現有的therubyracer和libv8 gems。

經過多次失敗嘗試各種方法后,我終於下載了Xcode,並且正如錯誤信息所暗示的那樣,那就是訣竅

上述答案都不適合我。 這是做了什么:

gem install libv8 -v '3.11.8.3'
gem install therubyracer -v '0.11.0beta5'

參考: https//coderwall.com/p/s8ofka

我的系統:

OSX Mountain Lion
Ruby 1.9.3

首先嘗試使用以下方法解決問題:

RUBYOPT=-rrubygems gem install therubyracer

如果錯誤仍然存​​在,請更新您的寶石:

bundle update

不同的寶石需要不同版本的GCC,因此這可能適用於所有寶石,也可能不適用,但這些符號鏈接解決了安裝了Xcode 4.4的Mountain Lion上的json,eventmachine和libv8寶石的問題。

sudo ln -s /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2

sudo ln -s /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 /usr/bin/g++-4.2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM