[Python-Dev] Fwd: distutils doesn't use some compiler options when building (original) (raw)

Akira Kitada akitada at gmail.com
Thu Nov 27 00:39:07 CET 2008


I didn't know distutils has its own list. Forwarding.

---------- Forwarded message ---------- From: Akira Kitada Date: Thu, Nov 27, 2008 at 2:28 AM Subject: distutils doesn't use some compiler options when building To: python-dev at python.org

Hi,

I encountered a weird problem using distutils. Generally, distutils try to use the same compiler options used for building Python interpreter, but it looks like some of them are omitted sometimes.

See: http://svn.python.org/view/python/trunk/Lib/distutils/sysconfig.py

""" def customize_compiler(compiler): ... if compiler.compiler_type == "unix": (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) =
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'SO')

   if 'CC' in os.environ:
       cc = os.environ['CC']
   if 'CXX' in os.environ:
       cxx = os.environ['CXX']
   if 'LDSHARED' in os.environ:
       ldshared = os.environ['LDSHARED']
   if 'CPP' in os.environ:
       cpp = os.environ['CPP']
   else:
       cpp = cc + " -E"           # not always
   if 'LDFLAGS' in os.environ:
       ldshared = ldshared + ' ' + os.environ['LDFLAGS']
   if 'CFLAGS' in os.environ:
       cflags = opt + ' ' + os.environ['CFLAGS']
       ldshared = ldshared + ' ' + os.environ['CFLAGS']
   if 'CPPFLAGS' in os.environ:
       cpp = cpp + ' ' + os.environ['CPPFLAGS']
       cflags = cflags + ' ' + os.environ['CPPFLAGS']
       ldshared = ldshared + ' ' + os.environ['CPPFLAGS']

   cc_cmd = cc + ' ' + cflags
   compiler.set_executables(
       preprocessor=cpp,
       compiler=cc_cmd,
       compiler_so=cc_cmd + ' ' + ccshared,
       compiler_cxx=cxx,
       linker_so=ldshared,
       linker_exe=cc)

   compiler.shared_lib_extension = so_ext

"""

Are these logics are intentional or just a bug? If this is intentional behavior, why is that being this way?

Thanks,



More information about the Python-Dev mailing list