[Python-Dev] build from source on mac uses clang, python.org binary uses gcc

Ronald Oussoren ronaldoussoren at mac.com
Thu Feb 14 13:15:55 CET 2013

On 14 Feb, 2013, at 10:18, Chris Withers <chris at simplistix.co.uk> wrote:

> Hi All,
> I've run into "some issues" installing lxml for python 3.3 on my mac:
> One of the stumbling blocks I've hit is that I built python 3.3 from source (./configure && make && make altinstall), and it used clang:
> buzzkill:virtualenvs chris$ /src/Python-3.3.0/python.exe
> Python 3.3.0 (default, Jan 23 2013, 09:56:03)
> [GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> ...which makes lxml pretty unhappy.

Why is that? Clang is a working C and C++ compiler. I've noticed in the past that lxml's automatic compilation
of libxml2 and libxslt is dodgy on OSX, but haven't had time yet to work on a patch that calculates the right
compiler flags instead of hardcoding some guesses in setup.py.  Also, libxml2 won't compile on OSX 10.8 at all
unless you use the version in the repository (an incompatibility with the pthread headers on 10.8).

You get clang instead of GCC when configure detects that clang is the only usable compiler on OSX,
where usable means that the compiler is present and is not llvm-gcc. Llvm-gcc contains bugs that
miscompile at least parts of the unicode implementation in CPython 3.3 and word on the street is that
these bugs won't get fixed unless they are also present in clang.

> However, when I install the binary Python 3.3 from python.org, it's built with GCC:
> buzzkill:virtualenvs chris$ python3.3
> Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 01:25:11)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> Why the difference?

The binary was created on an older release of OSX where gcc is a valid compiler choice. Distutils
should still pick clang when it detects that gcc is actually llvm-gcc though, doesn't it do that on your system?

BTW. Which OSX release are you using? And which variant of the OSX installer?


P.S. Isn't this a question for python-list?

> cheers,
> Chris
> -- 
> Simplistix - Content Management, Batch Processing & Python Consulting
>            - http://www.simplistix.co.uk
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com

More information about the Python-Dev mailing list