distutils unix gcc, still trying

Michiel Jan Laurens de Hoon mdehoon at ims.u-tokyo.ac.jp
Tue Aug 13 10:18:20 CEST 2002

Recently I got back to the question why distutils seems to ignore the CC 
environment variable. I have been told that distutils checks if CC is 
defined, and uses the corresponding compiler for the build process. 
However, I couldn't get this to work on my Unix system. I am trying to 
get distutils to use gcc instead of the standard cc compiler, but if I 
set CC=gcc then distutils still uses cc.

In an effort to get to the bottom of this, I looked at the distutils 
source code. As far as I can tell, distutils only checks the Makefile 
that was used to build Python. I didn't see any checks for the CC 
environment variable. Does anybody know in which routine of distutils 
this check takes place?

blue{mdehoon}23: set CC=gcc
blue{mdehoon}24: python setup.py build
running build
running build_py
not copying Pycluster/__init__.py (output up-to-date)
running build_ext
building 'Pycluster.cluster' extension
cc -DNDEBUG -O -OPT:Olimit=0 -Iranlib/src -I/usr/local/include/python2.2 
-c cluster.c -o build/temp.irix64-6.5-2.2/cluster.o

... and so on

Thanks in advance


> Michiel Jan Laurens de Hoon <mdehoon at ims.u-tokyo.ac.jp> writes:
>> Sorry ... it seems that distutils ignores the CC environment variable
>> (see below). This was done on cygwin. On Unix, the CC variable was
>> also ignored using setenv CC gcc, and also with set CC=gcc. Here
>> distutils defaulted to the standard cc compiler. I am guessing that it
>> took the compiler name from the Makefile in /lib/python2.2/config.
>> Any ideas?
> You can't take your Windows run as a proof that the variable is
> ignored. On Unix, it is honored.

More information about the Python-list mailing list