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