2

我通过 brew 在 OS X 上安装了 gcc6.1,当我尝试在我的 Mac 上安装 sciruby-full 时,总是得到这个错误:

>Fetching: nmatrix-0.1.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing sciruby-full:
    ERROR: Failed to build gem native extension.

    /usr/local/opt/ruby/bin/ruby -r ./siteconf20150627-98945-1pk3go6.rb extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... Exception `RuntimeError' at extconf.rb:144 - You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/Cellar/ruby/2.2.2/bin/$(RUBY_BASE_NAME)
extconf.rb:144:in `<main>': You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++. (RuntimeError)

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/nmatrix-0.1.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nmatrix-0.1.0/gem_make.out

我的 ruby​​ 和 OS X 总是最新的:更新 Yosemite 上的 Ruby 2.2.2。

4

2 回答 2

1

从您的错误消息中:

extconf.rb:144:in `': 你需要一个支持 -std=c++0x 或 -std=c++11 的 g++ 版本。如果您在 Mac 上使用 Homebrew,我们建议使用 mac-brew-gcc.sh 安装更新的 g++。(运行时错误)

于 2015-06-27T08:39:20.937 回答
1

执行以下操作(使用自制软件)

brew tap homebrew/versions
brew install gcc48

如果这不起作用,请尝试gcc47gcc46

注意:构建需要一段时间。gcc相当大。

于 2015-10-29T20:02:26.227 回答