I'm using OSX v10.11.6 with a recent version of xcode installed. So my default compiler is gcc
, which is really clang
. I have used homebrew to install gcc5 so that I can use openMP, and by setting CC := g++-5
in my Makefiles for my source code in C, I can successfully compile C source code with non-trivial usage of -fopenmp.
What I want to do is get Cython to compile with gcc5 so that I can use Cython's native prange feature, as demonstrated in a minimal example here. I have written a minimal example in this gist, borrowed from the Neal Hughes page. When I attempt to compile omp_testing.pyx
using setup.py
, I get a (possibly unrelated) warning, and fatal error:
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
omp_testing.cpp:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'g++-5' failed with exit status 1
After reading How to tell distutils to use gcc?, what I attempted was setting the CC
environment variable inside setup.py
, but this did not work. How should I modify my Cython setup.py
file to compile using g++-5?