Python on AIX

Python on AIX

Post by marc » Sat, 24 Nov 2001 07:37:30



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.

Cheers!

--

Gunnm: Broken Angel
http://reimeika.ca/

 
 
 

Python on AIX

Post by Martin von Loewi » Sun, 25 Nov 2001 00:29:10



> 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.

Unfortunately, it doesn't help Python developers much. What *would*
help is to have an expert on AIX with much time at his hands, who
understands all the problems and proposes a fix. That fix, ideally,
would work on all versions of AIX or clearly identify the versions it
does work for, and not interfere with the build procedure on other
systems (or generalize that so that AIX comes out as an instance of
the general procedure, instead of being a special case on its own).

Regards,
Martin

 
 
 

Python on AIX

Post by marc » Sun, 25 Nov 2001 02:53:45



Quote:> Unfortunately, it doesn't help Python developers much. What *would*
> help is to have an expert on AIX with much time at his hands, who
> understands all the problems and proposes a fix. That fix, ideally,
> would work on all versions of AIX or clearly identify the versions it
> does work for, and not interfere with the build procedure on other
> systems (or generalize that so that AIX comes out as an instance of
> the general procedure, instead of being a special case on its own).

I agree. However, I don't think that the extra () in the AIX case
statement of the Makefile is really OS-dependent, and it's easy
enough to fix (but of course I may be wrong :). It's a small glitch,
but these things do take time to figure out, and every bit helps.

The more complicated compilation problems are indeed of a different
nature altogether. Given AIX's niche position it's hard to achieve
the critical mass of experts/users required to weed out all (or most)
of the problems. But that's just the way it is, I guess...

Anyway, at the very least one can try to document the problems for
future generations, which was the main point of my post.

Cheers,

--

Gunnm: Broken Angel
http://reimeika.ca/

 
 
 

Python on AIX

Post by marc » Sun, 25 Nov 2001 02:59:19



> Once copied into /usr/local/python-2.2a4/lib/python2.2/ we
> re-ran the configure ; make ; make install. The following failed:

Sorry, that should have read:

/usr/local/python-2.2b2/lib/python2.2/

instead of /usr/local/python-2.2a4/lib/python2.2/.

Cheers,

--

Gunnm: Broken Angel
http://reimeika.ca/