File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,26 @@ versions of Python 2.7 >= 2.7.4 or Python 3.x >= 3.2.4 downloaded from
9595python.org. In all cases Xcode must be installed with 'UNIX Development
9696Support'.
9797
98+ **Xcode 5.1 **: Starting with version 5.1 the version of clang that ships with
99+ Xcode throws an error when it encounters compiler flags it doesn't recognize.
100+ This may cause C extension builds to fail with an error similar to::
101+
102+ clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
103+
104+ There are workarounds::
105+
106+ # Apple specified workaround for Xcode 5.1
107+ # easy_install
108+ $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install pymongo
109+ # or pip
110+ $ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pymongo
111+
112+ # Alternative workaround using CFLAGS
113+ # easy_install
114+ $ CFLAGS=-Qunused-arguments easy_install pymongo
115+ # or pip
116+ $ CFLAGS=-Qunused-arguments pip install pymongo
117+
98118Installing from source
99119----------------------
100120
Original file line number Diff line number Diff line change 11import glob
22import os
3+ import platform
4+ import re
35import subprocess
46import sys
57import warnings
4446
4547PY3 = sys .version_info [0 ] == 3
4648
49+ # PYTHON-654 - Clang doesn't support -mno-fused-madd but the pythons Apple
50+ # ships are built with it. This is a problem starting with Xcode 5.1
51+ # since clang 3.4 errors out when it encounters unrecognized compiler
52+ # flags. This hack removes -mno-fused-madd from the CFLAGS automatically
53+ # generated by distutils for Apple provided pythons, allowing C extension
54+ # builds to complete without error. The inspiration comes from older
55+ # versions of distutils.sysconfig.get_config_vars.
56+ if sys .platform == 'darwin' and 'clang' in platform .python_compiler ().lower ():
57+ from distutils .sysconfig import get_config_vars
58+ res = get_config_vars ()
59+ for key in ('CFLAGS' , 'PY_CFLAGS' ):
60+ if key in res :
61+ flags = res [key ]
62+ flags = re .sub ('-mno-fused-madd' , '' , flags )
63+ res [key ] = flags
64+
4765nose_config_options = {
4866 'with-xunit' : '1' , # Write out nosetests.xml for CI.
4967 'py3where' : 'build' , # Tell nose where to find tests under PY3.
You can’t perform that action at this time.
0 commit comments