distutils unix gcc, still trying

Lyle Johnson lyle at users.sourceforge.net
Tue Aug 13 13:37:09 EDT 2002


Michiel Jan Laurens de Hoon wrote:

> 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.

Try using:

     export CC=gcc

instead of "set".

> 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?

Yes. Before starting its compiles, the distutils.command.build_ext.run() 
method calls distutils.sysconfig.customize_compiler(), which looks up 
the values of environment variables like CC and does the necessary 
substitutions.




More information about the Python-list mailing list