Fix clang: error: unknown argument: ‘-mno-fused-madd’ after updating Xcode 5.1 or above

Standard

Story: How it all began.

I am a python programmer, and for a very long time I was getting segmentation fault error on my macbook running mavericks, every time I tried importing any module in shell, so which mean I can code and run the program but if I launch python shell and try to import something may it be sys or os package python will crash with a segmentation fault error.So recently I decided to do a new clean install of python by completely removing the old python2.7 installation. Then following instruction from this page But I didn’t had Xcode installed and not even command line tools for OSx mavericks. So I installed command line tools then installed python followed by virtualenv. This did fixed the segmentation fault error but thats where things got f**ked up !!! while I was removing python from my system I forgot that I am also learning in kivy and removed kivy too while removing python.  And now after so many days I thought to some coding in kivy realised I don’t have it. All this time I had installed fish shell when I first got the error I had first doubt on fish shell but that wasn’t it,  So now when I tried installing kivy using pip or easy_install i kept on getting error: clang: error: unknown argument: ‘-mno-fused-madd’ 

Solution

After lots of research on web and googling, I found many people had faced this issue after updating the Xcode  to 5.1 or above mine is 6.1 You can find your Xcode version using pkgutil –pkg-info=com.apple.pkg.CLTools_Executablespackage-id: com.apple.pkg.CLTools_Executables
version: 6.1.1.0.1.1416017670
install-time: 1423670043
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group 

$ gcc –version
Configured with: –prefix=/Library/Developer/CommandLineTools/usr –with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

 cc -fno-strict-aliasing -fno-common
 -dynamic
 -g -Os -pipe
 -fno-common
 -fno-strict-aliasing -fwrapv -mno-fused-madd
 -DENABLE_DTRACE
 -DMACOSX
 -DNDEBUG
 -Wall
 -Wstrict-prototypes
 -Wshorten-64-to-32
 -DNDEBUG
 -g
 -fwrapv
 -Os -Wall
 -Wstrict-prototypes
 -DENABLE_DTRACE
 -Wno-error=unused-command-line-argument-hard-error-in-future
 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /private/tmp/pip-build-UDRH26/kivy/kivy/graphics/texture.c -o build/temp.macosx-10.9-intel-2.7/private/tmp/pip-build-UDRH26/kivy/kivy/graphics/texture.o -F/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks -arch x86_64      clang: error: unknown argument: '-mno-fused-madd'       error: command 'cc' failed with exit status 1 
To fix the error I added the line
 export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
 in my ~/.bashrc file and restarted the shell, went to location where I had cloned the kivy from github and ran python setup.py install and now the above error appeared as warning and installation worked. So far so good everything is working now. I now have segregated every project using virtualenv as well as also took away doubt from fish shell 🙂
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s