2.4.2 on AIX fails compiling _codecs_cn.c

Paul Watson pwatson at redlinepy.com
Thu Nov 24 17:50:05 CET 2005


Martin v. Löwis wrote:
> Paul Watson wrote:
> 
>> It appears that _ALL_SOURCE gets defined in the 
>> /usr/include/standards.h file.  If we could #define _ANSI_C_SOURCE or 
>> _POSIX_SOURCE, it appears that it would eleminate _ALL_SOURCE.
> 
> 
> Ah, ok - this should be easy enough. Python would normally define
> _POSIX_SOURCE (through _XOPEN_SOURCE), but configure(.in) has this
> block:
> 
>   # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 
> 500 but
>   # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not 
> defined
>   # or has another value. By not (re)defining it, the defaults come in 
> place.
>   AIX/4)
>     define_xopen_source=no;;
>   AIX/5)
>     if test `uname -r` -eq 1; then
>       define_xopen_source=no
>     fi
>     ;;
> 
> which causes _XOPEN_SOURCE (and subsequently probably _POSIX_SOURCE) not 
> to be defined. What AIX version are you using? Can you try removing
> the fragment from configure(.in), rerun configure, verify that 
> _XOPEN_SOURCE is defined in pyconfig.h, and then try building again?
> 
> If this works, this might be a solution. Otherwise, we need to put 
> something like this into _codecs_cn.c:
> 
> #ifdef hz
> /* On AIX version such-and-such, hz is defined because _ALL_SOURCE is
>    defined, this in turn is defined because _XOPEN_SOURCE is not.
>    As _XOPEN_SOURCE cannot be enabled (see configure.in), we just
>    work around by removing the hz definition again. */
> #undef hz
> #endif
> 
> Regards,
> Martin

Commenting out the section in configure(.in) did not cause it to work. 
It still ended up with '100_encode' complaint.

Using '#undef hz' in ./Modules/cjkcodecs/_codecs_cn.c does cause it to 
compile.  However, it will not pass ./Lib/test/test_codecsencoding_cn.py 
or ./Lib/test/test_codecmaps_cn.py.  The others (_hk, _jp, _kr, and _tw) 
do pass the test.

I also note that compiles occurring after the complaint about not 
finding Tcl/Tk do not appear to get the OPT= setting I specified on the 
'make' command line.  It starts with compilation of structmodule.c and 
includes the _codecs_??.c files.  Does this have any significance?  Is 
it possible that there are other settings not being used?

$ python test_codecencodings_cn.py
test_chunkcoding (__main__.Test_GB2312) ... ERROR
test_customreplace (__main__.Test_GB2312) ... ERROR
test_errorhandle (__main__.Test_GB2312) ... ERROR
test_streamreader (__main__.Test_GB2312) ... ERROR
test_streamwriter (__main__.Test_GB2312) ... ERROR
test_xmlcharrefreplace (__main__.Test_GB2312) ... ERROR
test_chunkcoding (__main__.Test_GBK) ... ERROR
test_customreplace (__main__.Test_GBK) ... ERROR
test_errorhandle (__main__.Test_GBK) ... ERROR
test_streamreader (__main__.Test_GBK) ... ERROR
test_streamwriter (__main__.Test_GBK) ... ERROR
test_xmlcharrefreplace (__main__.Test_GBK) ... ERROR
test_chunkcoding (__main__.Test_GB18030) ... ERROR
test_customreplace (__main__.Test_GB18030) ... ERROR
test_errorhandle (__main__.Test_GB18030) ... ERROR
test_streamreader (__main__.Test_GB18030) ... ERROR
test_streamwriter (__main__.Test_GB18030) ... ERROR
test_xmlcharrefreplace (__main__.Test_GB18030) ... ERROR

======================================================================
ERROR: test_chunkcoding (__main__.Test_GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb2312

======================================================================
ERROR: test_customreplace (__main__.Test_GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb2312

======================================================================
ERROR: test_errorhandle (__main__.Test_GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb2312

======================================================================
ERROR: test_streamreader (__main__.Test_GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb2312

======================================================================
ERROR: test_streamwriter (__main__.Test_GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb2312

======================================================================
ERROR: test_xmlcharrefreplace (__main__.Test_GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb2312

======================================================================
ERROR: test_chunkcoding (__main__.Test_GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gbk

======================================================================
ERROR: test_customreplace (__main__.Test_GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gbk

======================================================================
ERROR: test_errorhandle (__main__.Test_GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gbk

======================================================================
ERROR: test_streamreader (__main__.Test_GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gbk

======================================================================
ERROR: test_streamwriter (__main__.Test_GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gbk

======================================================================
ERROR: test_xmlcharrefreplace (__main__.Test_GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gbk

======================================================================
ERROR: test_chunkcoding (__main__.Test_GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb18030

======================================================================
ERROR: test_customreplace (__main__.Test_GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb18030

======================================================================
ERROR: test_errorhandle (__main__.Test_GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb18030

======================================================================
ERROR: test_streamreader (__main__.Test_GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb18030

======================================================================
ERROR: test_streamwriter (__main__.Test_GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb18030

======================================================================
ERROR: test_xmlcharrefreplace (__main__.Test_GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/pwatson/usr/lib/python2.4/test/test_multibytecodec_support.py", 
line 27, in setUp
     self.codec = codecs.lookup(self.encoding)
LookupError: unknown encoding: gb18030

----------------------------------------------------------------------
Ran 18 tests in 0.015s

FAILED (errors=18)
Traceback (most recent call last):
   File "test_codecencodings_cn.py", line 60, in ?
     test_main()
   File "test_codecencodings_cn.py", line 57, in test_main
     test_support.run_suite(suite)
   File "/home/pwatson/usr/lib/python2.4/test/test_support.py", line 
274, in run_suite
     raise TestFailed(msg)
test.test_support.TestFailed: errors occurred; run in verbose mode for 
details
10:38 pwatson [ kbs80:/home/pwatson/src/python/Python-2.4.2/Lib/test ] 672
$ python test_codecencodings_hk.py
test_chunkcoding (__main__.Test_Big5HKSCS) ... ok
test_customreplace (__main__.Test_Big5HKSCS) ... ok
test_errorhandle (__main__.Test_Big5HKSCS) ... ok
test_streamreader (__main__.Test_Big5HKSCS) ... ok
test_streamwriter (__main__.Test_Big5HKSCS) ... ok
test_xmlcharrefreplace (__main__.Test_Big5HKSCS) ... ok

----------------------------------------------------------------------
Ran 6 tests in 0.063s

OK



More information about the Python-list mailing list