[Python-Dev] problem with compilation flags used by distutils

Toon Knapen toon.knapen at fft.be
Tue May 30 09:54:46 CEST 2006


We are compiling python on a multitude of platforms using a multitude of 
compilers and encountered problems when building python and 
python-extensions when specific flags need to be used by the compiler.

For instance, currently we're building the trunk on a Sun Solaris 9 
machine using Sun Studio 11. To make python compile in 64bit we execute 
the following sequence:

<commands>
export CC=cc
export CFLAGS="-xarch=v9"
export EXTRA_CFLAGS="-xarch=v9"
export CXX=CC
export CXXFLAGS="-xarch=v9"
export F77=f77
export FFLAGS="-xarch=v9"
export LDFLAGS="-xarch=v9"
./configure
</commands>

Unless we define 'EXTRA_CFLAGS' (which is not documented in `configure 
--help`) we need to add the "-xarch=v9" command-line option also 
manually to the generated Makefile to make sure python compiles with 
this option.

Next when compiling python-extensions (e.g. numarray) using distutils, 
distutils does not know it needs to pass the "-xarch=v9" option when 
linking a dynamic library. Distutils will still consult the LDFLAGS 
env.var. but IMO it also needs to use the content of LDFLAGS at the time 
python itself was compiled to secure that extensions are built 
compatible with python itself.


toon




More information about the Python-Dev mailing list