473,508 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2.4.2 on AIX fails compiling _codecs_cn.c

Any ideas why ./Modules/cjkcodecs/_codecs_cn.c fails to compile? It
appears that the CODEC_STATELESS macro is concatenating 'hz' with a
number and text.
building '_codecs_cn' extension
cc -DNDEBUG -O -I. -I/home/pwatson/src/python/Python-2.4.2/./Include
-I/home/pwatson/src/python/Python-2.4.2/Include
-I/home/pwatson/src/python/Python-2.4.2 -c
/home/pwatson/src/python/Python-2.4.2/Modules/cjkcodecs/_codecs_cn.c -o
build/temp.aix-4.3-2.4/_codecs_cn.o
"/home/pwatson/src/python/Python-2.4.2/Modules/cjkcodecs/_codecs_cn.c",
line 431.3: 1506-206 (S) Suffix of integer constant 100_encode is not valid.
"/home/pwatson/src/python/Python-2.4.2/Modules/cjkcodecs/_codecs_cn.c",
line 431.3: 1506-196 (W) Initialization between types "int(*)(union
{...}*,const void*,const unsigned short**,unsigned long,unsigned
char**,unsigned long,int)" and "int" is not allowed.
Nov 23 '05 #1
9 1957
Paul Watson wrote:
Any ideas why ./Modules/cjkcodecs/_codecs_cn.c fails to compile? It
appears that the CODEC_STATELESS macro is concatenating 'hz' with a
number and text.


More likely, hz is already defined to be 100, then forming 100_encode.

It would be best if you could find out what AIX header file defines
hz to be 100, and whether there is any way to supress that definition.

Regards,
Martin
Nov 23 '05 #2
Martin v. Löwis wrote:
Paul Watson wrote:
Any ideas why ./Modules/cjkcodecs/_codecs_cn.c fails to compile? It
appears that the CODEC_STATELESS macro is concatenating 'hz' with a
number and text.

More likely, hz is already defined to be 100, then forming 100_encode.

It would be best if you could find out what AIX header file defines
hz to be 100, and whether there is any way to supress that definition.

Regards,
Martin


This is on AIX 4.3.3

$ grep -i _hz $(find . -name m_param.h)
#define _HZ 100 /* ticks per second of the clock */
#define __hz HZ /* Berkeley uses lower case hz */
#define HZ _HZ
#define hz __hz

$ cc_r 2>&1|head -1
VisualAge C++ Professional / C for AIX Compiler, Version 5
Nov 23 '05 #3
Martin v. Löwis wrote:
Paul Watson wrote:
Any ideas why ./Modules/cjkcodecs/_codecs_cn.c fails to compile? It
appears that the CODEC_STATELESS macro is concatenating 'hz' with a
number and text.

More likely, hz is already defined to be 100, then forming 100_encode.

It would be best if you could find out what AIX header file defines
hz to be 100, and whether there is any way to supress that definition.

Regards,
Martin


Here are the /usr/include/*.h files that include sys/m_param.h

$ grep sys/m_param $(find . -name "*.h")
../sys/pthdebug.h:#include <sys/m_param.h> /* _NGPRS, _NFPRS */
../sys/context.h:#include <sys/m_param.h>
../sys/mstsave.h:#include <sys/m_param.h> /* for machine dependent
defines*/
../sys/param.h:#include <sys/m_param.h>
../sys/proc.h:#include <sys/m_param.h>
../sys/sched.h:#include <sys/m_param.h>

Can we #undef _ALL_SOURCE for _codecs_cn.c compilation?

There is a description in sys/context.h that seems to suggest that it is
an internal vs. external definition issue.

+44 /*
+45 * XPG4.2 requires structures and structure elements to be
defined such
+46 * that they do not pollute the namespace. _ALL_SOURCE
contains the
+47 * kernel version, while not _ALL_SOURCE contains the sanitized
versions.
+48 */
Nov 24 '05 #4
Paul Watson wrote:
This is on AIX 4.3.3

$ grep -i _hz $(find . -name m_param.h)
#define _HZ 100 /* ticks per second of the clock */
#define __hz HZ /* Berkeley uses lower case hz */
#define HZ _HZ
#define hz __hz


I expected to see something like this. However: in the file containing
the #define hz: Is there any #ifdef around it that could be
disabled/enabled?

Regards,
Martin
Nov 24 '05 #5
Paul Watson wrote:
Can we #undef _ALL_SOURCE for _codecs_cn.c compilation?


Where does _ALL_SOURCE come from? Why is it defined?
What is its effect on hz?

Regards,
Martin
Nov 24 '05 #6
Martin v. Löwis wrote:
Paul Watson wrote:
Can we #undef _ALL_SOURCE for _codecs_cn.c compilation?

Where does _ALL_SOURCE come from? Why is it defined?
What is its effect on hz?

Regards,
Martin


Martin v. Löwis wrote: Paul Watson wrote:
Can we #undef _ALL_SOURCE for _codecs_cn.c compilation?

Where does _ALL_SOURCE come from? Why is it defined?
What is its effect on hz?

Regards,
Martin


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.

$ cat t.c
#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("hello, world\n");

#ifdef _ALL_SOURCE
printf("hello, again\n");
#endif

exit(0);
}

$ cc_r t.c

$ ./a.out
hello, world
hello, again
Nov 24 '05 #7
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
Nov 24 '05 #8
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
Nov 24 '05 #9
Paul Watson wrote:
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?


At this point, I'm giving up. I would need access to an AIX and more
time than I have to be of further help.

Good luck,
Martin
Nov 24 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2518
by: A. B., Khalid | last post by:
Hello all. After a search on Google it would seem that the users of Mingw have not had good results in compiling the python sources natively. See at least: ...
7
2622
by: Jorge Schramm | last post by:
Hi, a collegue of mine is trying to write a serialisable container (reads at construction, writes at destruction). The writing part is pretty easy: simply iterate through the container and...
0
1034
by: stefvienna | last post by:
Hi group, I'm trying compiling Python-2.4.1 and it fails builing the _socket extension with the following message: building '_socket' extension gcc -pthread -DNDEBUG -g -O3 -Wall...
4
5867
by: Jon Rista | last post by:
I have a project where I need to create a windows .exe by compiling code and linking in some resources. This program thats being generated is somewhat unconventional, and I'll explain how. I'm...
2
1109
by: Paul Watson | last post by:
When I try to build 2.4.2 on AIX 4.3, it fails on missing thread objects. I ran ./configure --without-threads --without-gcc. Before using --without-threads I had several .pthread* symbols...
2
5669
by: Serman D. | last post by:
Hi all, I'm trying to complete the samples from the excellent 2003 developerWorks article "Bringing the Power of Regular Expression Matching to SQL" by Knut Stolze: http://tinyurl.com/3bhrnn...
8
2275
by: rays | last post by:
Hi, I am trying to port a C++ program which is supposed to be standards compliant. It works fine on Linux with GCC (4.x). But as I try to compile it on Windows, all hell breaks loose. I have been...
0
998
by: Robin Becker | last post by:
I am getting an error while building python-2.5.1 on a freebsd 6.1 machine as a normal user ../configure --prefix=/home/me/mypython --enable-unicode=ucs2 seems to work fine, but make install...
10
2183
by: Tomás Ó hÉilidhe | last post by:
I'd post this on a gcc newsgroup but I'd be more productive talking to the wall. Anyway, let's say someone throws some source code at you for a particular program and says, "Just compile it, it...
0
7233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7135
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.