Python on AIX
M.-A. Lemburg
mal at lemburg.com
Mon Nov 26 11:06:55 EST 2001
marco wrote:
>
> Hi all,
>
> We just recently compiled Python 2.2b2 under AIX 4.3.3
> using gcc 2.8.1. I'll just post our experience in case
> anybody finds it helpful. The original configure command
> was:
>
> ./configure \
> --prefix=/usr/local/python-2.2b2
>
> This uses cc_r (v. 5), and while this more or less worked,
> there were many of the following warnings:
>
> cc_r: 1501-210 command option t contains an incorrect subargument
>
> Later there were other problems but these were not
> really compiler-related (I did not know this at the time,
> though). Furthermore cc_r did not seem to have the threads
> problem I later encountered with gcc (and which are documented
> in the README). So, in summary, cc_r would have probably worked --
> perhaps better than with gcc -- but we didn't go down
> that road. Instead, we used the following:
>
> ./configure \
> --prefix=/usr/local/python-2.2b2 \
> --with-gcc
>
> and when trying to "make" got the following error:
>
> In file included from /usr/include/sys/thread.h:45,
> from /usr/include/sys/ptrace.h:28,
> from /usr/include/sys/proc.h:48,
> from /usr/include/sys/pri.h:29,
> from /usr/include/sys/sched.h:38,
> from /usr/include/sched.h:52,
> from /usr/include/pthread.h:43,
> from Python/thread_pthread.h:6,
> from Python/thread.c:117:
> /usr/include/sys/var.h:116: parse error before `__cptr64'
> .
> [snip a lot]
> .
> Python/thread_pthread.h:135: warning: implicit declaration of function `pthread_init'
> make: 1254-004 The error code from the last command is 1.
>
> As I mentioned above, this is documented in the README. We
> got around it by using:
>
> ./configure \
> --prefix=/usr/local/python-2.2b2 \
> --with-gcc \
> --with-threads=no
>
> The "make" then died with the following error:
>
> ./Modules/makexp_aix Modules/python.exp "" libpython2.2.a; -Wl,-bE:Modules/python.exp -lld -o python Modules/python.o libpython2.2.a -ldl -lm
> /bin/sh: -Wl,-bE:Modules/python.exp: not found.
> make: 1254-004 The error code from the last command is 127.
>
> Notice the space after the ";". Indeed, looking at the results
> from the configure script we see:
>
> checking LINKCC... ./configure[1417]: LINKCC: not found
> $(srcdir)/Modules/makexp_aix Modules/python.exp "" $(LIBRARY);
>
> Lines 1415 to 1417 of "configure" are as follows:
>
> case $ac_sys_system in
> AIX*)
> LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $(LINKCC)";;
>
> The problem turned out to be extra parenthesis around $(LINKCC). It should
> read:
>
> AIX*)
> LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
>
> The lines after that read:
>
> dgux*)
> LINKCC="LD_RUN_PATH=$libdir $(LINKCC)";;
> Monterey64*)
> LINKCC="$(LINKCC) -L/usr/lib/ia64l64";;
> esac
>
> Presumably these too have extra ()s.
>
> Once that was fixed there were further complaints along the following
> lines:
>
> WARNING: building of extension "fcntl" failed: command '/usr/local/python-2.2a4/lib/python2.2/ld_so_aix' failed with exit status 1
>
> There seemed to be some confusion between the source directory
> and the installation directory (which was set with --prefix to be
> /usr/local/python-2.2b2). The file it was looking for was in fact
> under the "Modules" subdirectory within the Python source tree.
> The simplest workaround was to copy the files it wanted to the
> appropriate location. These were:
>
> ld_so_aix
> makexp_aix
> python.exp
>
> Once copied into /usr/local/python-2.2a4/lib/python2.2/ we
> re-ran the configure ; make ; make install. The following failed:
>
> /usr/local/src2/marco/Python-2.2b2/Modules/socketmodule.c: In function `PyH_Err':
> /usr/local/src2/marco/Python-2.2b2/Modules/socketmodule.c:432: warning: implicit declaration of function `hstrerror'
> WARNING: building of extension "_socket" failed: command 'gcc' failed with exit status 1
>
> /usr/local/src2/marco/Python-2.2b2/Modules/_cursesmodule.c:2348: too few arguments to function `tparm'
> WARNING: building of extension "_curses" failed: command 'gcc' failed with exit status 1
>
> /usr/local/src2/marco/Python-2.2b2/Modules/_curses_panel.c:17: panel.h: No such file or directory
> WARNING: building of extension "_curses_panel" failed: command 'gcc' failed with exit status 1
>
> However, we can live for now without the socket and curses modules. Other
> than that Python seems to be OK. Note that precompiled Python binaries (in
> RPM form) are available for AIX at:
> http://www-1.ibm.com/servers/aix/products/aixos/linux/download.html
>
> We haven't tried those, though. Still, we hope this is helpful for
> people trying to perform the compilation on their own, and to the
> Python developers by letting them know about the glitches we encountered.
Some tips:
* Make sure that you always use GNU make on AIX -- the one shipped
with AIX is braindead.
* AIX is a mixed 32-bit/64-bit platform -- this results in a whole
bunch of problems; one thing to make sure is that you always use
the same bit-length for the interpreter, the extensions and the libs
you link against. Tip: use the same compiler, make and optimization
options for all parts of the product build process.
* Try to compile Python using
./configure --without-gcc
make CC=cc_r OPT="-O2 -qmaxmem=4000" install
Please upload your findings to the Python bug tracker; the socket
module should definitely build on AIX, not sure about fcntl and
curses.
BTW, does anyone know how well Python runs on the new AIX 5L ?
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/
More information about the Python-list
mailing list