472,782 Members | 1,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

Compiling Python 2.5.2 on AIX 5.2

I'm investigating the possible use of Mecurial SCM as a replacement
for CVS. Mecurial is written in Python. I have a background in GNU/
Linux, Solaris, sparc and Perl. However AIX, powerpc and Python are
new to me.

--uname output--
$ uname -rvp
2 5 powerpc
--end uname output--

I used this script to compile Python:
--script--
export PATH=/usr/bin:/usr/vacpp/bin
export CC=xlC_r
export OBJECT_MODE=32
gunzip -c Python-2.5.2.tar.gz | tar xvf -
cd Python-2.5.2
../configure --with-gcc="xlc_r" --with-cxx="xlC_r" \
--disable-ipv6 AR="ar" --prefix=$HOME
make
--end script--

My concern is when I run make test I get this output:
--make test output--
275 tests OK.
2 tests failed:
test_mmap test_wait4
45 tests skipped:
test_aepack test_al test_applesingle test_bsddb test_bsddb185
test_bsddb3 test_bz2 test_cd test_cl test_codecmaps_cn
test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
test_codecmaps_tw test_ctypes test_curses test_dl test_gdbm
test_gl test_gzip test_imgfile test_largefile test_linuxaudiodev
test_macfs test_macostools test_nis test_normalization
test_ossaudiodev test_pep277 test_plistlib test_scriptpackages
test_socket_ssl test_socketserver test_sqlite test_startfile
test_sunaudiodev test_tcl test_timeout test_urllib2net
test_urllibnet test_winreg test_winsound test_zipfile64
test_zipimport test_zlib
2 skips unexpected on aix5:
test_largefile test_ctypes
make: *** [test] Error 1
--end make test output--

My question are:

(a) Have you successfully compiled Python 2.5.2 on AIX 5.2? If so,
which options did you place in the environment and send to ./
configure?

(b) Given the choice between xlc and gcc 4.2.2 (which we have on the
platform) which one is considered more suitable?

(c) I am concerned about the two failing test cases: test_mmap and
test_wait4. Are there good reasons why these failures can be safely
ignored?

(d) Should I be concerned with the skips of test_largefile and
test_ctypes?

Much thanks in advance.

Kind regards,
-Randy Galbraith

Jun 27 '08 #1
9 3783
On 2008-04-13 18:57, Ra*************@gmail.com wrote:
I'm investigating the possible use of Mecurial SCM as a replacement
for CVS. Mecurial is written in Python. I have a background in GNU/
Linux, Solaris, sparc and Perl. However AIX, powerpc and Python are
new to me.
On AIX 5.3, Python 2.5.2 should build out of the box using gcc.

We've successfully build Python 2.3, 2.4 and 2.5 on AIX 5.3
using the gcc compiler suite and tools installed from the
AIX Linux Toolbox:

http://www-03.ibm.com/systems/p/os/a...ox/altlic.html

../configure --enable-unicode=ucs2 --with-gcc

For 2.3 and 2.4 you need to patch pyconfig.h after the
configure run:

*** pyconfig.h~ Wed Nov 14 17:22:01 2007
--- pyconfig.h Wed Nov 14 17:22:01 2007
***************
*** 49,55 ****
/* #undef HAVE_BROKEN_POLL */

/* Define if the Posix semaphores do not work on your system */
! /* #undef HAVE_BROKEN_POSIX_SEMAPHORES */

/* Define if pthread_sigmask() does not work on your system. */
/* #undef HAVE_BROKEN_PTHREAD_SIGMASK */
--- 49,55 ----
/* #undef HAVE_BROKEN_POLL */

/* Define if the Posix semaphores do not work on your system */
! #define HAVE_BROKEN_POSIX_SEMAPHORES 1

/* Define if pthread_sigmask() does not work on your system. */
/* #undef HAVE_BROKEN_PTHREAD_SIGMASK */
--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source (#1, Apr 14 2008)
>>Python/Zope Consulting and Support ... http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
__________________________________________________ ______________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
Jun 27 '08 #2
On Apr 14, 7:01 am, "M.-A. Lemburg" <m...@egenix.comwrote:
On AIX 5.3, Python 2.5.2 should build out of the box using gcc.

We've successfully build Python 2.3, 2.4 and 2.5 on AIX 5.3
using the gcc compiler suite and tools installed from the
AIX Linux Toolbox:

http://www-03.ibm.com/systems/p/os/a...ox/altlic.html

./configure --enable-unicode=ucs2 --with-gcc

For 2.3 and 2.4 you need to patch pyconfig.h after the
configure run:
Marc-Andre,

Thanks so much for responding. I had to add --disable-ipv6 to ./
configure to prevent this problem:

checking getaddrinfo bug... buggy
Fatal: You must get working getaddrinfo() function.
or you can specify "--disable-ipv6".

When I checked pyconfig.h to make the patch you suggested I noticed
line 60 already reads like this:

#define HAVE_BROKEN_POSIX_SEMAPHORES 1

When ran make I immediately ran into problems. I'll investigate and
post back the results. Any comments and direction here is
appreciated.

$ make
gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o
Modules/python.o ./Modules/python.c
In file included from Include/Python.h:83,
from ./Modules/python.c:3:
Include/unicodeobject.h:73:2: error: #error Must define
Py_UNICODE_SIZE

What is Py_UNICODE_SIZE and why was it not defined? There are current
questions I have.

Kind regards,
-Randy Galbraith
ps. Based on uname -rvp output of "2 5 powerpc" I'm assuming my OS is
AIX 5.2 on PowerPC. I noticed you said you're on AIX 5.3. I'm not
100% sure I'm understanding uname output correctly.
Jun 27 '08 #3
What is Py_UNICODE_SIZE and why was it not defined? There are current
questions I have.
Py_UNICODE_SIZE is the number of bytes that a Py_UNICODE value should
have in the interpreter. With --enable-unicode=ucs2, it should be 2.

I cannot guess why it is not defined; check pyconfig.h to find out
whether there is a definition. If not, look in your configure output
for the line

checking what type to use for unicode...

and perhaps edit configure to print out additional messages around
the place where it deals with Py_UNICODE.

Regards,
Martin
Jun 27 '08 #4
On Apr 15, 11:33 pm, "Martin v. Lwis" <mar...@v.loewis.dewrote:
What is Py_UNICODE_SIZE and why was it not defined? There are current
questions I have.

Py_UNICODE_SIZE is the number of bytes that a Py_UNICODE value should
have in the interpreter. With --enable-unicode=ucs2, it should be 2.
Martin,

Thanks for your reply. I feel like a dummy, when I was following Marc-
Andre's instructions I incorrectly typed "--enable-
unicode=ucs24" (note the "4"). Once I fixed that the Py_UNICODE_SIZE
issue went away.

Alas, I still am having problems compiling and getting a clean run
through make test. I got this error:

Python-2.5.2/Modules/bz2module.c:12:19: error: bzlib.h: No such file
or directory

Which I solved by copying bzlib.h I have on the system to Python-2.5.2/
Include/.

The run of make test resulted in this error:

test_ctypes
find_library('c') - None
find_library('m') - None
make: *** [test] Segmentation fault (core dumped)

An examination of the core with gdb shows this:

$ gdb python core
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
[snip]
This GDB was configured as "powerpc-ibm-aix5.2.0.0"...
Core was generated by `python'.
Program terminated with signal 11, Segmentation fault.
#0 0xdebccc5c in ffi_closure_helper_DARWIN (closure=0xdebcd050,
rvalue=0x2ff20230, pgr=0x2ff20258, pfr=0x2ff201c8)
at Python-2.5.2/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c:
626
626 avalue = alloca(cif->nargs * sizeof(void *));
(gdb) bt
#0 0xdebccc5c in ffi_closure_helper_DARWIN (closure=0xdebcd050,
rvalue=0x2ff20230, pgr=0x2ff20258, pfr=0x2ff201c8)
at Python-2.5.2/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c:
626
#1 0xdebcd2bc in ffi_closure_ASM () from build/lib.aix-5.2-2.5/
_ctypes.so
#2 0xdebcd458 in ffi_call_AIX () from build/lib.aix-5.2-2.5/
_ctypes.so
#3 0xdebccf24 in ffi_call (cif=0xdebcd050, fn=@0x2ff20288:
0x2ff20350,
rvalue=0x2ff20258, avalue=0x2ff201c8)
at Python-2.5.2/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c:
421
#4 0xdebcb5e8 in _CallProc (pProc=@0x30000fc8: 0xdebcd248
<ffi_closure_ASM>,
argtuple=0x20d5e9ac, flags=4097, argtypes=0x20d5eb2c,
restype=0x20e7dc44,
checker=0x0)
at Python-2.5.2/Modules/_ctypes/callproc.c:668

[snip frames #5 to #55]

#56 0x10063a70 in PyEval_EvalCode (co=0xdebcd050, globals=0x2ff20230,
locals=0x2ff20258) at Python/ceval.c:494
cals=0x2ff20258) at Python/ceval.c:494
(gdb) print cif
$1 = (ffi_cif *) 0x140
(gdb) print *cif
$3 = {abi = 1600485481, nargs = 1946157056, arg_types = 0x0, rtype =
0x400a,
bytes = 1, flags = 0}

Thus it would seem use cif here resulted in a segment violation. I'll
continue to research this issue and report back to the group as I know
more. Perhaps solving the issue with the 'c' and 'm' libraries
(whatever they might be) will make the core dump go away. However,
for tonight, I'll need to stop here.

Kind regards,
-Randy Galbraith
Jun 27 '08 #5
Thus it would seem use cif here resulted in a segment violation. I'll
continue to research this issue and report back to the group as I know
more. Perhaps solving the issue with the 'c' and 'm' libraries
(whatever they might be) will make the core dump go away. However,
for tonight, I'll need to stop here.
I recommend you disable compilation of ctypes (by removing the call
to detect_ctypes from setup.py). It's fairly unlikely that you can
manage to make ctypes work on your system.

Regards,
Martin
Jun 27 '08 #6
On Apr 20, 10:17 pm, "Martin v. Lwis" <mar...@v.loewis.dewrote:
I recommend you disable compilation of ctypes (by removing the call
to detect_ctypes from setup.py). It's fairly unlikely that you can
manage to make ctypes work on your system.
Martin, Thanks again. I'm much closer now. Here is the script I'm
using to compile Python on AIX:

--begin script--
cp /path/to/include/bzlib.h Include/.
cat <<EOF | patch setup.py
*** setup.py.xxreg042108 2008-04-21 13:19:24.000000000 -0700
--- setup.py 2008-04-21 13:20:56.000000000 -0700
***************
*** 1052,1058 ****
exts.append( Extension('dl', ['dlmodule.c']) )

# Thomas Heller's _ctypes module
! self.detect_ctypes(inc_dirs, lib_dirs)

# Platform-specific libraries
if platform == 'linux2':
--- 1052,1059 ----
exts.append( Extension('dl', ['dlmodule.c']) )

# Thomas Heller's _ctypes module
! #self.detect_ctypes(inc_dirs, lib_dirs)
! # Removed for AIX as per Martin v. Lowis 4/21/08

# Platform-specific libraries
if platform == 'linux2':
EOF
./configure --enable-unicode=ucs2 --with-gcc\
--disable-ipv6 --prefix=$HOME
--end script--

make then compiles relatively cleanly. However, make test results in
this:

276 tests OK.
2 tests failed:
test_mmap test_wait4
44 tests skipped:
test_aepack test_al test_applesingle test_bsddb test_bsddb185
[snip]
2 skips unexpected on aix5:
test_largefile test_ctypes
make: *** [test] Error 1

The concern of course is why mmap and wait4 failed. Earlier in the
make test output we see this for mmap:

test test_mmap crashed -- <type 'exceptions.EnvironmentError'>: [Errno
22] Invalid argument

and for wait4:

test test_wait4 failed -- Traceback (most recent call last):
File "Python-2.5.2/Lib/test/fork_wait.py", line 75, in test_wait
self.wait_impl(cpid)
File "Python-2.5.2/Lib/test/test_wait4.py", line 28, in wait_impl
self.assertEqual(spid, cpid)
AssertionError: 0 != 6840386

What do these failures indicate? Not sure of course, but will
research and report back.

Kind regards,
-Randy Galbraith
"We seem to be made to suffer. It's our lot in life." - C3PO of Star
Wars
Jun 27 '08 #7
test test_mmap crashed -- <type 'exceptions.EnvironmentError'>: [Errno
22] Invalid argument
You should run this with -v. This is too little detail to know what
exactly failed.
self.assertEqual(spid, cpid)
AssertionError: 0 != 6840386

What do these failures indicate?
That suggests a bug in wait4: apparently, it fails to correctly return
the PID. Could be an OS bug, but more likely, it's a type problem in
Modules/posixmodule.c.

Regards,
Martin
Jun 27 '08 #8
On Apr 22, 11:17 am, "Martin v. Lwis" <mar...@v.loewis.dewrote:
test test_mmap crashed -- <type 'exceptions.EnvironmentError'>: [Errno
22] Invalid argument

You should run this with -v. This is too little detail to know what
exactly failed.
Sorry it took so long to get back to you. At this point, I'm going to
attempt to use python on AIX 5.2 even with the mmap and wait4
failures. My main requirement running Mercurial SCM, so hopefully the
python binary I have will do the job.

Nonetheless, I wanted to quickly dump out the expanded results you
suggested might help.

Running this:
./python Lib/test/test_mmap.py -v

Resulted in this:
--results--
<type 'mmap.mmap'>
Position of foo: 1.0 pages
Length of file: 2.0 pages
Contents of byte 0: '\x00'
Contents of first 3 bytes: '\x00\x00\x00'

Modifying file's content...
Contents of byte 0: '3'
Contents of first 3 bytes: '3\x00\x00'
Contents of second page: '\x00foobar\x00'
Regex match on mmap (page start, length of match): 1.0 6
Seek to zeroth byte
Seek to 42nd byte
Seek to last byte
Try to seek to negative position...
Try to seek beyond end of mmap...
Try to seek to negative position...
Attempting resize()
Creating 10 byte test data file.
Opening mmap with access=ACCESS_READ
Ensuring that readonly mmap can't be slice assigned.
Ensuring that readonly mmap can't be item assigned.
Ensuring that readonly mmap can't be write() to.
Ensuring that readonly mmap can't be write_byte() to.
Ensuring that readonly mmap can't be resized.
Opening mmap with size too big
Opening mmap with access=ACCESS_WRITE
Modifying write-through memory map.
Opening mmap with access=ACCESS_COPY
Modifying copy-on-write memory map.
Traceback (most recent call last):
File "Lib/test/test_mmap.py", line 393, in <module>
test_both()
File "Lib/test/test_mmap.py", line 247, in test_both
m.flush()
EnvironmentError: [Errno 22] Invalid argument
--end results--

btw I'm not sure if -v was required in this direct run. Running w/o -
v gave the same results.

Now, over to wait4. Your comment was:
That suggests a bug in wait4: apparently, it fails to correctly return
the PID. Could be an OS bug, but more likely, it's a type problem in
Modules/posixmodule.c.
Running this:
./python Lib/test/test_wait4.py

Resulted in this:
--results--
test_wait (__main__.Wait4Test) ... FAIL

================================================== ====================
FAIL: test_wait (__main__.Wait4Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/..<snip>../Python-2.5.2/Lib/test/fork_wait.py", line 75, in
test_wait
self.wait_impl(cpid)
File "Lib/test/test_wait4.py", line 28, in wait_impl
self.assertEqual(spid, cpid)
AssertionError: 0 != 8417358

----------------------------------------------------------------------
Ran 1 test in 12.066s

FAILED (failures=1)
Traceback (most recent call last):
File "Lib/test/test_wait4.py", line 37, in <module>
test_main()
File "Lib/test/test_wait4.py", line 33, in test_main
run_unittest(Wait4Test)
File "/..<snip>../Python-2.5.2/Lib/test/test_support.py", line 451,
in run_unittest
run_suite(suite, testclass)
File "/..<snip>../Python-2.5.2/Lib/test/test_support.py", line 436,
in run_suite
raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
File "/..<snip>../Python-2.5.2/Lib/test/fork_wait.py", line 75, in
test_wait
self.wait_impl(cpid)
File "Lib/test/test_wait4.py", line 28, in wait_impl
self.assertEqual(spid, cpid)
AssertionError: 0 != 8417358
--end results--

Thanks for taking your time to respond. It is truly appreciated at
this end.

Kind regards,
-Randy Galbraith
Jun 27 '08 #9
Opening mmap with access=ACCESS_COPY
Modifying copy-on-write memory map.
Traceback (most recent call last):
File "Lib/test/test_mmap.py", line 393, in <module>
test_both()
File "Lib/test/test_mmap.py", line 247, in test_both
m.flush()
EnvironmentError: [Errno 22] Invalid argument
I see. This is

http://bugs.python.org/issue678250

Regards,
Martin
Jun 27 '08 #10

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

Similar topics

0
by: Joonas Paalasmaa | last post by:
Hi, When compiling Sketch's streamfilter C extension the errors below are raised during linking. What could cause the errors? (Python 2.3, MinGw 1.1 with GCC 2.95.3-6, Windows 98) Here are...
2
by: Giraud, Sebastien | last post by:
Ok I was still looking for a 'make like' software and found one : MacMillan Entreprise Just work fine even if it's not easy to handle it... -----Message d'origine----- De :...
0
by: Johnathan Doe | last post by:
I've been thinking about what the issues would be in compiling Python into native machine code, and since type information is important in Python, it seems possible that Python code can be...
29
by: Maurice LING | last post by:
Hi, I remembered reading a MSc thesis about compiling Perl to Java bytecodes (as in java class files). At least, it seems that someone had compiled scheme to java class files quite successfully....
6
by: Martin Bless | last post by:
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME C++ compiler and linker Python is built with...
0
by: mmarkzon | last post by:
I have been struggling compiling linkchecker from http://linkchecker.sourceforge.net/. The last thing I get is "error: command 'gcc' failed with exit status 1" which is not very helpful. This is...
0
by: phoolimin | last post by:
Dear all, I am trying to embed python into another scripting language, to do this I need to solve a number of problems on importing or compiling python script. First let me state what exactly I...
2
by: metaperl | last post by:
I've tried both Python 2.4.4 and Python 2.5. I'm trying to build from source and install under a local directory Swarm since OpenSwarm requires builds of Postgres and Python under it's control. ...
11
by: ZMY | last post by:
Dear all, I am a real newbie for both python and QNX, but I am still trying to compile Numeric-24.2 under QNX4.25 with python 2.2. I got following error message: $ sudo python setup.py...
2
by: eliben | last post by:
On Jun 27, 3:10 pm, eliben <eli...@gmail.comwrote: Problem solved: http://eli.thegreenplace.net/2008/06/28/compiling-python-extensions-with-distutils-and-mingw/
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

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.