| 1 |
|
| 2 |
This documentation tries to help people who intend to use Python on |
| 3 |
AIX. |
| 4 |
|
| 5 |
There used to be many issues with Python on AIX, but the major ones |
| 6 |
have been corrected for version 3.2, so that Python should now work |
| 7 |
rather well on this platform. The remaining known issues are listed in |
| 8 |
this document. |
| 9 |
|
| 10 |
|
| 11 |
====================================================================== |
| 12 |
Compiling Python |
| 13 |
---------------------------------------------------------------------- |
| 14 |
|
| 15 |
You can compile Python with gcc or the native AIX compiler. The native |
| 16 |
compiler used to give better performances on this system with older |
| 17 |
versions of Python. With Python 3.2 it may not be the case anymore, |
| 18 |
as this compiler does not allow compiling Python with computed gotos. |
| 19 |
Some benchmarks need to be done. |
| 20 |
|
| 21 |
Compiling with gcc: |
| 22 |
|
| 23 |
cd Python-3.2 |
| 24 |
CC=gcc OPT="-O2" ./configure --enable-shared |
| 25 |
make |
| 26 |
|
| 27 |
There are various aliases for the native compiler. The recommended |
| 28 |
alias for compiling Python is 'xlc_r', which provides a better level of |
| 29 |
compatibility and handles thread initialization properly. |
| 30 |
|
| 31 |
It is a good idea to add the '-qmaxmem=70000' option, otherwise the |
| 32 |
compiler considers various files too complex to optimize. |
| 33 |
|
| 34 |
Compiling with xlc: |
| 35 |
|
| 36 |
cd Python-3.2 |
| 37 |
CC=xlc_r OPT="-O2 -qmaxmem=70000" ./configure --without-computed-gotos --enable-shared |
| 38 |
make |
| 39 |
|
| 40 |
Note: |
| 41 |
On AIX 5.3 and earlier, you will also need to specify the |
| 42 |
"--disable-ipv6" flag to configure. This has been corrected in AIX |
| 43 |
6.1. |
| 44 |
|
| 45 |
|
| 46 |
====================================================================== |
| 47 |
Memory Limitations |
| 48 |
---------------------------------------------------------------------- |
| 49 |
|
| 50 |
Note: this section may not apply when compiling Python as a 64 bit |
| 51 |
application. |
| 52 |
|
| 53 |
By default on AIX each program gets one segment register for its data |
| 54 |
segment. As each segment register covers 256 MB, a Python program that |
| 55 |
would use more than 256MB will raise a MemoryError. The standard |
| 56 |
Python test suite is one such application. |
| 57 |
|
| 58 |
To allocate more segment registers to Python, you must use the linker |
| 59 |
option -bmaxdata or the ldedit tool to specify the number of bytes you |
| 60 |
need in the data segment. |
| 61 |
|
| 62 |
For example, if you want to allow 512MB of memory for Python (this is |
| 63 |
enough for the test suite to run without MemoryErrors), you should run |
| 64 |
the following command at the end of compilation: |
| 65 |
|
| 66 |
ldedit -b maxdata:0x20000000 ./python |
| 67 |
|
| 68 |
You can allow up to 2GB of memory for Python by using the value |
| 69 |
0x80000000 for maxdata. |
| 70 |
|
| 71 |
It is also possible to go beyond 2GB of memory by activating Large |
| 72 |
Page Use. You should consult the IBM documentation if you need to use |
| 73 |
this option. You can also follow the discussion of this problem |
| 74 |
in issue 11212 at bugs.python.org. |
| 75 |
|
| 76 |
http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/ldedit.htm |
| 77 |
|
| 78 |
|
| 79 |
====================================================================== |
| 80 |
Known issues |
| 81 |
---------------------------------------------------------------------- |
| 82 |
|
| 83 |
Those issues are currently affecting Python on AIX: |
| 84 |
|
| 85 |
* Python has not been fully tested on AIX when compiled as a 64 bit |
| 86 |
application. |
| 87 |
|
| 88 |
* issue 3526: the memory used by a Python process will never be |
| 89 |
released to the system. If you have a Python application on AIX that |
| 90 |
uses a lot of memory, you should read this issue and you may |
| 91 |
consider using the provided patch that implements a custom malloc |
| 92 |
implementation |
| 93 |
|
| 94 |
* issue 11184: support for large files is currently broken |
| 95 |
|
| 96 |
* issue 11185: os.wait4 does not behave correctly with option WNOHANG |
| 97 |
|
| 98 |
* issue 1745108: there may be some problems with curses.panel |
| 99 |
|
| 100 |
* issue 11192: test_socket fails |
| 101 |
|
| 102 |
* issue 11190: test_locale fails |
| 103 |
|
| 104 |
* issue 11193: test_subprocess fails |
| 105 |
|
| 106 |
* issue 9920: minor arithmetic issues in cmath |
| 107 |
|
| 108 |
* issue 11215: test_fileio fails |
| 109 |
|
| 110 |
* issue 11188: test_time fails |
| 111 |
|
| 112 |
|
| 113 |
====================================================================== |
| 114 |
Implementation details for developers |
| 115 |
---------------------------------------------------------------------- |
| 116 |
|
| 117 |
Python and python modules can now be built as shared libraries on AIX |
| 118 |
as usual. |
| 119 |
|
| 120 |
AIX shared libraries require that an "export" and "import" file be |
| 121 |
provided at compile time to list all extern symbols which may be |
| 122 |
shared between modules. The "export" file (named python.exp) for the |
| 123 |
modules and the libraries that belong to the Python core is created by |
| 124 |
the "makexp_aix" script before performing the link of the python |
| 125 |
binary. It lists all global symbols (exported during the link) of the |
| 126 |
modules and the libraries that make up the python executable. |
| 127 |
|
| 128 |
When shared library modules (.so files) are made, a second shell |
| 129 |
script is invoked. This script is named "ld_so_aix" and is also |
| 130 |
provided with the distribution in the Modules subdirectory. This |
| 131 |
script acts as an "ld" wrapper which hides the explicit management of |
| 132 |
"export" and "import" files; it adds the appropriate arguments (in the |
| 133 |
appropriate order) to the link command that creates the shared module. |
| 134 |
Among other things, it specifies that the "python.exp" file is an |
| 135 |
"import" file for the shared module. |
| 136 |
|
| 137 |
This mechanism should be transparent. |