2014年4月23日 星期三

安裝 Xcode 5.1 Command line tools 所引起的問題

在 MacOS 10.9.2 上面如果有安裝 xcode command line tools,當你在裝第三方packages (python pip or ruby gem)而且有compile native library (大部份應該都是 c library),請記得加入這樣的 flag 在你環境上:


Ruby

sudo  gem update --verbose

export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
sudo gem update --verbose


Python

pip install xxx

export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
pip install xxx


不然就會感受到 compiler 很熱情地抱怨...

./ruby_xml_encoding.h:11:51: note: passing argument to parameter 'xencoding' here
VALUE rxml_new_cstr(const char* xstr, const char* xencoding);
                                                  ^
1 warning generated.
compiling ruby_xml_xpointer.c
linking shared-object libxml_ruby.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: *** [libxml_ruby.bundle] Error 1


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/libxml-ruby-2.7.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/libxml-ruby-2.7.0/ext/libxml/gem_make.out
Updating mini_portile
Fetching: mini_portile-0.6.0.gem (100%)
Successfully installed mini_portile-0.6.0
Parsing documentation for mini_portile-0.6.0
Installing ri documentation for mini_portile-0.6.0
Installing darkfish documentation for mini_portile-0.6.0
Updating nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
 ERROR: Failed to build gem native extension.

這應該是 Apple 為了避免出現類似 iOS 7.0.4 裡面的 gotofail bug,所設下的 flag。
有一好沒兩好...