Friday, March 28, 2014

Install MySQL library for python on MacOS

Both clang and gcc in latest xcode command line tool have some problem while compiling MySQL-python
An error say "unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]"

Here's the problematic gcc and clang version
ffmb13:~ fanfei$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

ffmb13:~ fanfei$ clang -v
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

To work around the issue, we can set environment variable ARCHFLAGS during the compiling.
brew install mysql
su
export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
pip install MySQL-python

No comments:

Post a Comment