[Numpy-discussion] how is toolchain selected for compiling (OS X with python.org build)?

Andrew Jaffe a.h.jaffe at gmail.com
Thu Oct 15 11:49:17 EDT 2015

This isn't, strictly speaking, a numpy question, but I suspect it's 
something that numpy devs and users have some insight into.

I am trying to compile an extension that requires a fairly advanced c++ 
compiler. Using the built-in apple python, it defaults to the latest 
clang from apple, and it works just fine.

Using the python.org framework build, it still selects clang, which is 
in principle a new enough compiler, but for some reason it seems to end 
up pointing to /usr/include/c++/4.2.1/ which of course is too old, and 
the build fails.

So the questions I have are:

  - *why* is it using such an old toolchain (I am pretty sure that the 
answer is backward compatibility, and specifically because that is the 
way the framework build python is itself compiled).

  - *how* is it selecting those tools, and in particular, that include 
directory? It doesn't seem to explicitly show up in the logs, until 
there's an error. If I just use the same clang invocation as seems to be 
used by the build, it is able to compile full C++-11 code...

  - Is there any way to still use the apple clang, but in full c++-11 
mode to build extensions?

The solution/workaround is to install and then explicitly select a more 
advanced compiler, e.g., from homebrew, using environment variables, but 
it would be nice if it could work out of the box, and ideally with the 
same behaviour as with apple's python build.


p.s. for the aficionados, this is for [healpy][1], and we're looking at 
it with [this issue][2].

[1]: https://github.com/healpy
[2]: https://github.com/healpy/healpy/issues/284#issuecomment-148354405

More information about the NumPy-Discussion mailing list