[issue8918] distutils test failure on solaris: IOError: [Errno 2] No such file or directory: '_configtest.i'

Sridhar Ratnakumar report at bugs.python.org
Mon Jun 14 23:53:42 CEST 2010


Sridhar Ratnakumar <sridharr at activestate.com> added the comment:

-bash-3.00$ cat _configtest.c 
// xxx
-bash-3.00$ 

-------------------------------------

This is how the C compiler is invoked:

$ cc -E -o _configtest.i _configtest.c  
# 1 "_configtest.c"
 
#ident "acomp: Sun C 5.9 SunOS_i386 2007/05/03"
$

It does not generate a _configtest.i file .. which is because the `-E` option on Solaris sends the preprocessed output directly to `stdout` without respecting the `-o` option. From "man cc",

     -E   Runs the source file through the preprocessor only and
          sends the output to stdout. The preprocessor is built
          directly into the compiler, except in -Xs mode, where
          /usr/ccs/lib/cpp is invoked. Includes the preprocessor
          line numbering information. See also -P option.

But the `-P` option does output to the .i file:

     -P   Preprocesses only the named C files and leaves the
          result in corresponding files suffixed .i.  The output
          will not contain any preprocessing line directives,
          unlike -E.

So the fix is to use `-P` instead of `-E` on Solaris. I see that `-E` is used in lib/python2.7/distutils/ccompiler.py .. around this line:

        else:
            cpp = cc + " -E"           # not always

Tarek, note the "not always" command above. At least, we now know that on Solaris this happens to be "-P".

The resulting .i file is:

-bash-3.00$ cat _configtest.i 
 
#ident "acomp: Sun C 5.9 SunOS_i386 2007/05/03"
-bash-3.00$ 

-------------------------------------

As for `cc` itself:

-bash-3.00$ which cc
/usr/bin/cc
-bash-3.00$ cc -V
cc: Sun C 5.9 SunOS_i386 2007/05/03
usage: cc [ options] files.  Use 'cc -flags' for details

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8918>
_______________________________________


More information about the Python-bugs-list mailing list