文章都是從個人我的博客上轉載過來的,你們能夠點擊個人我的博客.python
www.iwangzheng.comjson
mac上安裝rails的時候報錯,ruby
安裝rails的在終端執行了一句命令:ui
$sudo gem install railsthis
報錯了,報錯信息爲命令行
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]code
完整的執行過程及報錯信息以下:ip
angela@angeladeMacBook-Air:~$sudo gem install railsrem
Password:generator
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [generator.bundle] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
緣由很簡單,
Xcode 5.1中的蘋果編譯器將不認識的命令行視爲錯誤行爲。這類報錯常出如今ruby和python的安裝過程當中,由於這兩類程序中,不少編譯語句較爲特殊。
解決方案就是在安裝語句前面加上這句
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future ,
以安裝rails爲例,使用如下的語句:
$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install rails