[Python-bugs-list] [ python-Bugs-767374 ] #define _XOPEN_SOURCE in pyconfig.h causes problems for AIX

SourceForge.net noreply@sourceforge.net
Mon, 07 Jul 2003 14:56:56 -0700


Bugs item #767374, was opened at 2003-07-07 23:23
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=767374&group_id=5470

Category: Build
Group: Python 2.3
>Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Tom Epperly (tepperly)
Assigned to: Nobody/Anonymous (nobody)
Summary: #define _XOPEN_SOURCE in pyconfig.h causes problems for AIX

Initial Comment:
I installed Python 2.3b1 on an AIX system. The
following simple program fails to compile. This is an
extremely simplified version of an #include problem
that occurs in a larger code that includes Python C
extension modules.

epperly@aixbox[~]>cat test_prog.c
#include <standards.h>
#include <Python.h>
 
int main(char argc, char **argv)
{
  return 0;
}
epperly@aixbox[~]>!new
newcc -Ipython/include/python2.3/ test_prog.c
"python/include/python2.3/pyconfig.h", line 841.9:
1506-236 (W) Macro name _XOPEN_SOURCE has been redefined.
"python/include/python2.3/pyconfig.h", line 841.9:
1506-358 (I) "_XOPEN_SOURCE" is defined on line 89 of
/usr/include/standards.h.
"/usr/include/wchar.h", line 290.68: 1506-046 (S)
Syntax error.
"/usr/include/wchar.h", line 293.68: 1506-046 (S)
Syntax error.
epperly@aixbox[~]>uname -a
AIX aixbox 1 5 006008594C0

The main problem is that pyconfig.h #define's
_XOPEN_SOURCE to 600 and wchar.h only does the right
thing if _XOPEN_SOURCE is defined to be 500.


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

>Comment By: Martin v. Löwis (loewis)
Date: 2003-07-07 23:56

Message:
Logged In: YES 
user_id=21627

There is no way to avoid this. Including Python.h may change
the contents of header files, e.g. by changing the size of
off_t. It is absolutely necessary to have these changes in
effect before system headers are included, or else there
would be ABI inconsistencies.

It is regrettable that vendors require us to implement such
requirements to use useful features (e.g. LFS).

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

Comment By: Tom Epperly (tepperly)
Date: 2003-07-07 23:52

Message:
Logged In: YES 
user_id=94539

Requiring #include <Python.h> to be first is a regretable
design decision that other software packages regretably also
make. It makes interoperability a challenge.

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

Comment By: Tom Epperly (tepperly)
Date: 2003-07-07 23:50

Message:
Logged In: YES 
user_id=94539

I set some environment variables that impact the configure run:
CC=newcc
CXX=newxlC
F77=newxlf
F90=newxlf90 -qsuffix=f=f90
CPP=gcc -E

I am rerunning the test with Python2.3b2. Here is how I am
invoking configure.
./configure --prefix=${HOME}/python23b2 --enable-shared
--disable-ipv6


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

Comment By: Martin v. Löwis (loewis)
Date: 2003-07-07 23:47

Message:
Logged In: YES 
user_id=21627

This is not a bug in Python, but in your code. Python.h must
be the first include file.



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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=767374&group_id=5470