Title: distutils test_config_cmd failure on Solaris
Type: behavior Stage: resolved
Components: Distutils, Tests Versions: Python 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: alef, alexis, delhallt, dstufft, eric.araujo, srid, tarek
Priority: normal Keywords:

Created on 2010-06-06 17:50 by srid, last changed 2020-10-23 03:51 by eric.araujo. This issue is now closed.

Messages (7)
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/", 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/", 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


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/ .. around this line:

            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"


As for `cc` itself:

-bash-3.00$ which 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
msg153680 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-19 09:11
We have a Solaris buildbot but it’s offline, so I don’t know if this bug is still current.  If it is, then it should be easy to use “cc + ' -P'” for that OS (IIUC the test can just be “if sys.platform == 'solaris'”).
msg184163 - (view) Author: alef (alef) Date: 2013-03-14 13:14
The same happens with AIX 6.1 using xlc 10.1. Using -P implies removing -o output_file. The resulting _configtest.i is anyhow empty, even using -qppline.
msg188501 - (view) Author: Delhallt (delhallt) Date: 2013-05-06 09:45
For your information, with AIX 6.1, with both print line and preserve comment the output is not empty.

Option -o, with i suffix always give error message /usr/vac/bin/xlc_r: 1501-218 (S) file _configline.i contains an incorrect file suffix

#/usr/vac/bin/xlc_r -P _configtest.c -qppline -C
#cat _configtest.i                              
#line 1 "_configtest.c"
/* xxx */
msg221137 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-21 00:35
Is there a good reason for this being set to third party when it was raised against Python 2.7rc1?  Is it still a problem with the 2.7 series or any of the 3.x series?
Date User Action Args
2020-10-23 03:51:23eric.araujosetstatus: open -> closed
assignee: eric.araujo ->
components: - Distutils2
versions: - 3rd party
nosy: + dstufft

resolution: out of date
stage: test needed -> resolved
2019-03-15 23:37:20BreamoreBoysetnosy: - BreamoreBoy
2014-06-21 00:35:39BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221137
2013-05-06 09:45:20delhalltsetnosy: + delhallt

messages: + msg188501
versions: - Python 3.2, Python 3.3
2013-03-14 13:14:35alefsetnosy: + alef
messages: + msg184163
2012-02-19 09:11:23eric.araujosetassignee: tarek -> eric.araujo

components: + Distutils2
title: distutils test failure on solaris: IOError: [Errno 2] No such file or directory: '_configtest.i' -> distutils test_config_cmd failure on Solaris
nosy: + alexis, eric.araujo
versions: + 3rd party, Python 3.2, Python 3.3
messages: + msg153680
stage: test needed
2010-06-14 21:53:40sridsetmessages: + msg107815
2010-06-06 21:39:01tareksetmessages: + msg107235
2010-06-06 17:50:58sridcreate