From 4b7df29bd19f6de8a871e6a57e569ccc17262af3 Mon Sep 17 00:00:00 2001 From: anaconda Date: Sun, 16 Jun 2013 01:59:48 +0200 Subject: [PATCH] Fix GCC on Darwin for Python 3. distutils.sysconfig.get_config_var('CC') returns the compiler used to build Python, which may be not installed on the system where uWSGI is being built. In my case, I grabbed Python 3.3.2 from python.org: it was apparently compiled with 'gcc-4.2', but my system only has 'gcc' (symlink) and 'llvm-gcc-4.2'. This change tries to detect this situation (only on Darwin) and sets GCC to 'llvm-' + compiler returned by sysconfig. --- uwsgiconfig.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 32768cf7..de7df33a 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -476,6 +476,8 @@ def open_profile(filename): class uConf(object): def __init__(self, filename, mute=False): + global GCC + self.config = ConfigParser.ConfigParser() if not mute: print("using profile: %s" % filename) @@ -528,11 +530,10 @@ class uConf(object): if uwsgi_os == 'GNU': self.cflags.append('-D__HURD__') - try: - gcc_version = str(spcall("%s -dumpversion" % GCC)) - except: - print("*** you need a c compiler to build uWSGI ***") - sys.exit(1) + gcc_version = spcall("%s -dumpversion" % GCC) + if not gcc_version and GCC.startswith('gcc') and uwsgi_os == 'Darwin': + GCC = 'llvm-' + GCC + gcc_version = spcall("%s -dumpversion" % GCC) try: add_it = False