classification
Title: distutils test failure on solaris: IOError: [Errno 2] No such file or directory: '_configtest.i'
Type: behavior Stage:
Components: Distutils, Tests Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: tarek Nosy List: srid, tarek
Priority: normal Keywords:

Created on 2010-06-06 17:50 by srid, last changed 2010-06-14 21:53 by srid.

Messages (3)
msg107196 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-06-06 17:50
OS = SunOS ginsu 5.10 Generic_125101-10 i86pc i386 i86pc
Python 2.7rc1

======================================================================
ERROR: test_search_cpp (distutils.tests.test_config_cmd.ConfigTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/export/home/apy/rrun/tmp/autotest/apy/lib/python2.7/distutils/tests/test_config_cmd.py", line 46
, in test_search_cpp
    match = cmd.search_cpp(pattern='xxx', body='// xxx')
  File "/export/home/apy/rrun/tmp/autotest/apy/lib/python2.7/distutils/command/config.py", line 211, in search_cpp
    file = open(out)
IOError: [Errno 2] No such file or directory: '_configtest.i'
msg107235 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-06-06 21:39
I don't have this platform, could you investigate for me Srid ?

Looks like self._preprocess() fails for some reason. we need to trace this down.
msg107815 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-06-14 21:53
-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
History
Date User Action Args
2010-06-14 21:53:40sridsetmessages: + msg107815
2010-06-06 21:39:01tareksetmessages: + msg107235
2010-06-06 17:50:58sridcreate