我正在尝试在我的mac os上安装mechainze gem,但是当我输入gem install mechanize时,几秒钟之后,它就开始了:
Building native extensions. This could take a while...
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
/Users/Tim/.rvm/rubies/ruby-1.9.3-p545/bin/ruby extconf.rb
checking for main() in -lstdc++... yes
checking for ruby/encoding.h... yes
creating Makefile
make clean
make
compiling unf.cc
g++: error: unrecognized command line option '-Wshorten-64-to-32'
make: *** [unf.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Tim/.rvm/gems/ruby-1.9.3-p545@global/gems/unf_ext-0.0.6 for inspection.
Results logged to /Users/Tim/.rvm/gems/ruby-1.9.3-p545@global/extensions/x86_64-darwin-12/1.9.1/unf_ext-0.0.6/gem_make.out
我不知道为什么会这样,是否有人愿意帮忙?
谢谢!
PS:我发现实际上很久以前我将默认编译器设置为g ++而不是clang。这有关系吗?
答案 0 :(得分:0)
实际上这确实是由于我将默认编译器切换到gcc4.7引起的。我换回后(命令:sudo port select --set gcc llvm-gcc42),顺利进行。