我向namkeung@us.ibm.com请教如何在AIX 5L上编译Python 2.3.x。他给出了以下步骤,我还没验证过。
Here's the general instructions to build the python 2.3.x:
1)
Download the source from python.org:
ftp://ftp.python.org/pub/python/%{version}/Python-%{version}.tar.bz2
ftp://ftp.python.org/pub/python/doc/%{version}/html-%{version}.tar.bz2
(where %{version} is "2.3.2").
2)
Get the following two source patches from the AIX Toolbox site, for the
previous python version (2.2):
ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/PATCHES/Python-2.2-pypath.patch
ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/PATCHES/Python-2.2-termios.patch
Those same two patches need to be applied to the 2.3.2 source.
3)
Visit the AIX Toolbox site and make sure you have the basic development
build tools installed, like 'make', 'patch', 'm4', 'coreutils'. Also, to
build python, you should have at least 'tk' and 'tcl' as well.
Also, you should have the IBM Visual Age C/C++ compilers installed.
4)
Unpack/Extract the 2 downloaded sources and apply the two code patches noted
above, using the patch command. Then, there are a couple new code changes to
make:
In the extracted source, in the file "setup.py": Go to about line 1009,
where you will see a comment saying "# Add the Tcl/Tk libraries". On a new
line immediately below this comment, add a line that says:
added_lib_dirs.append('/usr/lib -Wl,-brtl')
(there might be a better way to accomplish the same thing, but I don't know
python myself and this does work; basically I'm just trying to add that
flag right before the tk and tcl libraries on the command line).
Then in the same file, 4 lines below this point, you'll see a grouping of
aix versions, ['aix3', 'aix4']: Add aix5 to that- ['aix3', 'aix4', 'aix5']:
Next change, in file "Makefile.pre.in":
Go to line 348, and you'll see a line that starts with the variable
$(LDSHARED). Add a 'B' to make that $(BLDSHARED). Then do the same thing
on the line 3 lines down. Then again on the line 4 lines below that, for
a total of 3 changes of $(LDSHARED) to $(BLDSHARED).
5)
Two more patches to make, which you can apply with a couple simple commands
while you are in the top level of the extracted source tree:
perl -pi -e "s|/usr/lpp/xlC/include/load.h|/usr/vacpp/include/load.h|;" Python/dynload_aix.c configure.in configure
perl -pi -e "s|yperr_string|(const char*)yperr_string|g;" Modules/nismodule.c
6) You should be in the top directory of the extracted source.
Now you are ready to build. Put /usr/linux/bin first in your path and set
other environment variables:
# export PATH=/usr/linux/bin:$PATH
# export OPT="-qcpluscmt -O -qmaxmem=-1 -DAIX_GENUINE_CPLUSPLUS"
# export LIBS="-lC"
And then run configure:
# ./configure --without-pymalloc --prefix=/opt/freeware --with-cxx=xlC_r --enable-shared --with-threads --disable-ipv6
Here's the general instructions to build the python 2.3.x:
1)
Download the source from python.org:
ftp://ftp.python.org/pub/python/%{version}/Python-%{version}.tar.bz2
ftp://ftp.python.org/pub/python/doc/%{version}/html-%{version}.tar.bz2
(where %{version} is "2.3.2").
2)
Get the following two source patches from the AIX Toolbox site, for the
previous python version (2.2):
ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/PATCHES/Python-2.2-pypath.patch
ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/PATCHES/Python-2.2-termios.patch
Those same two patches need to be applied to the 2.3.2 source.
3)
Visit the AIX Toolbox site and make sure you have the basic development
build tools installed, like 'make', 'patch', 'm4', 'coreutils'. Also, to
build python, you should have at least 'tk' and 'tcl' as well.
Also, you should have the IBM Visual Age C/C++ compilers installed.
4)
Unpack/Extract the 2 downloaded sources and apply the two code patches noted
above, using the patch command. Then, there are a couple new code changes to
make:
In the extracted source, in the file "setup.py": Go to about line 1009,
where you will see a comment saying "# Add the Tcl/Tk libraries". On a new
line immediately below this comment, add a line that says:
added_lib_dirs.append('/usr/lib -Wl,-brtl')
(there might be a better way to accomplish the same thing, but I don't know
python myself and this does work; basically I'm just trying to add that
flag right before the tk and tcl libraries on the command line).
Then in the same file, 4 lines below this point, you'll see a grouping of
aix versions, ['aix3', 'aix4']: Add aix5 to that- ['aix3', 'aix4', 'aix5']:
Next change, in file "Makefile.pre.in":
Go to line 348, and you'll see a line that starts with the variable
$(LDSHARED). Add a 'B' to make that $(BLDSHARED). Then do the same thing
on the line 3 lines down. Then again on the line 4 lines below that, for
a total of 3 changes of $(LDSHARED) to $(BLDSHARED).
5)
Two more patches to make, which you can apply with a couple simple commands
while you are in the top level of the extracted source tree:
perl -pi -e "s|/usr/lpp/xlC/include/load.h|/usr/vacpp/include/load.h|;" Python/dynload_aix.c configure.in configure
perl -pi -e "s|yperr_string|(const char*)yperr_string|g;" Modules/nismodule.c
6) You should be in the top directory of the extracted source.
Now you are ready to build. Put /usr/linux/bin first in your path and set
other environment variables:
# export PATH=/usr/linux/bin:$PATH
# export OPT="-qcpluscmt -O -qmaxmem=-1 -DAIX_GENUINE_CPLUSPLUS"
# export LIBS="-lC"
And then run configure:
# ./configure --without-pymalloc --prefix=/opt/freeware --with-cxx=xlC_r --enable-shared --with-threads --disable-ipv6
浙公网安备 33010602011771号