Force setup.py use my own compiler

I am trying to get setup.py to compile C ++ code with gcc version of macports. The problem is that the code I'm trying to create does not support mac default clang, which by default is gcc for newer versions of osx.

I created my own setup.cfgfile

setup.cfg

[build_ext] 
compiler=gcc-mp-4.8

However, when I run python setup.py build_ext, I get the following error:

running build_ext

error: don't know how to compile C/C++ code on platform 'posix' with 'gcc-mp-4.8' compiler

How can I get setup.py to use my version of gcc gcc-mp-4.8?

Currently setup.py uses by default /usr/bin/clangwhen I type gcc -v, it shows that it is using gcc version 4.8.2

+4
source share
1

--compiler "unix", "msvc", "cygwin", "mingw32", "bcpp" "emx". , CC.

setup.py os.environ:

os.environ["CC"] = "gcc-4.8"
os.environ["CXX"] = "gcc-4.8"

:

CC=gcc

g++ ;

os.environ["CXX"] = "g++-4.7"
+4

All Articles