gem 安装 unf_ext -v '0.0.6' 在 Mountain Lion Mac 上失败

gem install unf_ext -v '0.0.6' fails on Mountain Lion mac

本文关键字:Lion Mountain Mac 失败 unf gem 安装 ext      更新时间:2023-10-16

这是我运行bundle install时遇到的错误

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
        /Users/sam/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby extconf.rb 
checking for main() in -lstdc++... yes
checking for ruby/encoding.h... no
creating Makefile
CXX is automatically set to g++-4.6
make
g++-4.6  -I. -I/opt/local/include -I. -I/Users/sam/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/1.8/i686-darwin12.5.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -g -O2 -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl098/include  -fno-common -pipe -fno-common    -c unf.cc
make: g++-4.6: No such file or directory
make: *** [unf.o] Error 1

Gem files will remain installed in /Users/sam/.rvm/gems/ree-1.8.7-2012.02@global/gems/unf_ext-0.0.6 for inspection.
Results logged to /Users/sam/.rvm/gems/ree-1.8.7-2012.02@global/gems/unf_ext-0.0.6/ext/unf_ext/gem_make.out
An error occurred while installing unf_ext (0.0.6), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.6'` succeeds before bundling.

看起来缺少 g++ 4.6。

which g++返回/usr/bin/g++which g++-4.6什么也没返回。

我肯定安装了Xcode开发人员工具。我真的不知道该怎么办。如何使捆绑包安装成功?

使用 jruby 安装正常。我使用的 ree 版本似乎有问题。