diff --git a/Misc/AIX-NOTES b/Misc/AIX-NOTES deleted file mode 100644 index d928f53e844..00000000000 --- a/Misc/AIX-NOTES +++ /dev/null @@ -1,155 +0,0 @@ -Subject: AIX - Misc/AIX-NOTES -From: Vladimir Marangozov -To: guido@CNRI.Reston.Va.US (Guido van Rossum) -Date: Wed, 6 Aug 1997 11:41:00 +0200 (EET) - -============================================================================== - COMPILER INFORMATION ------------------------------------------------------------------------------- - -(1) A problem has been reported with "make test" failing because of "weird - indentation." Searching the comp.lang.python newsgroup reveals several - threads on this subject, and it seems to be a compiler bug in an old - version of the AIX CC compiler. However, the compiler/OS combination - which has this problem is not identified. In preparation for the 1.4 - release, Vladimir Marangozov (Vladimir.Marangozov@imag.fr) and Manus Hand - (mhand@csn.net) reported no such troubles for the following compilers and - operating system versions: - AIX C compiler version 3.1.2 on AIX 4.1.3 and AIX 4.1.4 - AIX C compiler version 1.3.0 on AIX 3.2.5 - If you have this problem, please report the compiler/OS version. - -(2) Stefan Esser (se@MI.Uni-Koeln.DE), in work done to compile Python - 1.0.0 on AIX 3.2.4, reports that AIX compilers don't like the LANG - environment varaiable set to European locales. This makes the compiler - generate floating point constants using "," as the decimal separator, - which the assembler doesn't understand (or perhaps it is the other way - around, with the assembler expecting, but not getting "," in float - numbers). "LANG=C; export LANG" solves the problem, as does - "LANG=C $(MAKE) ..." in the master Makefile. - -(3) The cc (or xlc) compiler considers "Python/ceval.c" too complex to - optimize, except when invoked with "-qmaxmem=4000" - -(4) Some problems (due to _AIX not being #defined) when python 1.0.0 was - compiled using 'gcc -ansi' were reported by Stefan Esser, but were not - investigated. - -(5) The cc compiler has internal variables named "__abs" and "__div". These - names are reserved and may not be used as program variables in compiled - source. (As an anecdote in support of this, the implementation of - Python/operator.c had this problem in the 1.4 beta releases, and the - solution was to re#define some core-source variables having these names, - to give these python variables different names if the build is being done - on AIX.) - -(6) As mentioned in the README, builds done immediately after previous builds - (without "make clean" or "make clobber") sometimes fail for mysterious - reasons. There are some unpredictable results when the configuration - is changed (that is, if you "configure" with different parameters) or if - intermediate changes are made to some files. Performing "make clean" or - "make clobber" resolves the problems. - -============================================================================== - THREAD SUPPORT ------------------------------------------------------------------------------- - -As of AIX version 4, there are two (incompatible) types of pthreads on AIX: - a) AIX DCE pthreads (on AIX 3.2.5) - b) AIX 4 pthreads (on AIX 4.1 and up) -Support has been added to Python to handle the distinction. - -The cc and gcc compilers do not initialize pthreads properly. The only -compilers that can initialize pthreads properly are IBM *_r* compilers, -which use the crt0_r.o module, and which invoke ld with the reentrant -version of libc (libc_r). - -In order to enable thread support, follow these steps: - 1. Uncomment the thread module in Modules/Setup - 2. configure --without-gcc --with-thread ... - 3. make CC="cc_r" OPT="-O -qmaxmem=4000" - -For example, to make with both threads and readline, use: - ./configure --without-gcc --with-thread --with-readline=/usr/local/lib - make CC=cc_r OPT="-O2 -qmaxmem=4000" - -If the "make" which is used ignores the "CC=cc_r" directive, one could alias -the cc command to cc_r (for example, in C-shell, perform an "alias cc cc_r"). - -Vladimir Marangozov (Vladimir.Marangozov@imag.fr) provided this information, -and he reports that a cc_r build initializes threads properly and that all -demos on threads run okay with cc_r. - -============================================================================== - SHARED LIBRARY SUPPORT ------------------------------------------------------------------------------- - -AIX shared library support was added to Python in the 1.4 release by Manus -Hand (mhand@csn.net) and Vladimir Marangozov (Vladimir.Marangozov@imag.fr). - -Python modules may now be built as shared libraries on AIX using the normal -process of uncommenting the "*shared*" line in Modules/Setup before the -build. - -AIX shared libraries require that an "export" and "import" file be provided -at compile time to list all extern symbols which may be shared between -modules. The "export" file (named python.exp) for the modules and the -libraries that belong to the Python core is created by the "makexp_aix" -script before performing the link of the python binary. It lists all global -symbols (exported during the link) of the modules and the libraries that -make up the python executable. - -When shared library modules (.so files) are made, a second shell script -is invoked. This script is named "ld_so_aix" and is also provided with -the distribution in the Modules subdirectory. This script acts as an "ld" -wrapper which hides the explicit management of "export" and "import" files; -it adds the appropriate arguments (in the appropriate order) to the link -command that creates the shared module. Among other things, it specifies -that the "python.exp" file is an "import" file for the shared module. - -At the time of this writing, neither the python.exp file nor the makexp_aix -or ld_so_aix scripts are installed by the make procedure, so you should -remember to keep these and/or copy them to a different location for -safekeeping if you wish to use them to add shared extension modules to -python. However, if the make process has been updated since this writing, -these files MAY have been installed for you during the make by the -LIBAINSTALL rule, in which case the need to make safe copies is obviated. - -If you wish to add a shared extension module to the language, you would follow -the steps given in the example below (the example adds the shared extension -module "spam" to python): - 1. Make sure that "ld_so_aix" and "makexp_aix" are in your path. - 2. The "python.exp" file should be in the current directory. - 3. Issue the following commands or include them in your Makefile: - cc -c spammodule.c - ld_so_aix cc spammodule.o -o spammodule.so - -For more detailed information on the shared library support, examine the -contents of the "ld_so_aix" and "makexp_aix" scripts or refer to the AIX -documentation. - -NOTE: If the extension module is written in C++ and contains templates, - an alternative to "ld_so_aix" is the /usr/lpp/xlC/bin/makeC++SharedLib - script. Chris Myers (myers@TC.Cornell.EDU) reports that ld_so_aix - works well for some C++ (including the C++ that is generated - automatically by the Python SWIG package [SWIG can be found at - http://www.cs.utah.edu/~beazley/SWIG/swig.html]). However, it is not - known whether makeC++SharedLib can be used as a complete substitute - for ld_so_aix. - -According to Gary Hook from IBM, the format of the export file changed -in AIX 4.2. For AIX 4.2 and later, a period "." is required on the -first line after "#!". If python crashes while importing a shared -library, you can try modifying the LINKCC variable in the Makefile. -It probably looks like this: - - LINKCC= $(srcdir)/Modules/makexp_aix Modules/python.exp \"\" $(LIBRARY); $(PURIFY) $(CXX) - -You should modify the \"\" to be a period: - - LINKCC= $(srcdir)/Modules/makexp_aix Modules/python.exp . $(LIBRARY); $(PURIFY) $(CXX) - -Using a period fixed the problem in the snake farm. YMMV. -This fix has been incorporated into Python 2.3. - -============================================================================== diff --git a/Misc/NEWS b/Misc/NEWS index a96dbc859b1..2f05aebf99a 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -178,6 +178,8 @@ Extensions Build ----- +- Issue #11184: Fix large-file support on AIX. + - Issue #941346: Fix broken shared library build on AIX. - Issue #7716: Under Solaris, don't assume existence of /usr/xpg4/bin/grep in diff --git a/Misc/README.AIX b/Misc/README.AIX new file mode 100644 index 00000000000..b3e64724d76 --- /dev/null +++ b/Misc/README.AIX @@ -0,0 +1,137 @@ + +This documentation tries to help people who intend to use Python on +AIX. + +There used to be many issues with Python on AIX, but the major ones +have been corrected for version 3.2, so that Python should now work +rather well on this platform. The remaining known issues are listed in +this document. + + +====================================================================== + Compiling Python +---------------------------------------------------------------------- + +You can compile Python with gcc or the native AIX compiler. The native +compiler used to give better performances on this system with older +versions of Python. With Python 3.2 it may not be the case anymore, +as this compiler does not allow compiling Python with computed gotos. +Some benchmarks need to be done. + +Compiling with gcc: + +cd Python-3.2 +CC=gcc OPT="-O2" ./configure --enable-shared +make + +There are various aliases for the native compiler. The recommended +alias for compiling Python is 'xlc_r', which provides a better level of +compatibility and handles thread initialization properly. + +It is a good idea to add the '-qmaxmem=70000' option, otherwise the +compiler considers various files too complex to optimize. + +Compiling with xlc: + +cd Python-3.2 +CC=xlc_r OPT="-O2 -qmaxmem=70000" ./configure --without-computed-gotos --enable-shared +make + +Note: +On AIX 5.3 and earlier, you will also need to specify the +"--disable-ipv6" flag to configure. This has been corrected in AIX +6.1. + + +====================================================================== + Memory Limitations +---------------------------------------------------------------------- + +Note: this section may not apply when compiling Python as a 64 bit +application. + +By default on AIX each program gets one segment register for its data +segment. As each segment register covers 256 MB, a Python program that +would use more than 256MB will raise a MemoryError. The standard +Python test suite is one such application. + +To allocate more segment registers to Python, you must use the linker +option -bmaxdata or the ldedit tool to specify the number of bytes you +need in the data segment. + +For example, if you want to allow 512MB of memory for Python (this is +enough for the test suite to run without MemoryErrors), you should run +the following command at the end of compilation: + +ldedit -b maxdata:0x20000000 ./python + +You can allow up to 2GB of memory for Python by using the value +0x80000000 for maxdata. + +It is also possible to go beyond 2GB of memory by activating Large +Page Use. You should consult the IBM documentation if you need to use +this option. You can also follow the discussion of this problem +in issue 11212 at bugs.python.org. + +http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/ldedit.htm + + +====================================================================== + Known issues +---------------------------------------------------------------------- + +Those issues are currently affecting Python on AIX: + +* Python has not been fully tested on AIX when compiled as a 64 bit + application. + +* issue 3526: the memory used by a Python process will never be + released to the system. If you have a Python application on AIX that + uses a lot of memory, you should read this issue and you may + consider using the provided patch that implements a custom malloc + implementation + +* issue 11184: support for large files is currently broken + +* issue 11185: os.wait4 does not behave correctly with option WNOHANG + +* issue 1745108: there may be some problems with curses.panel + +* issue 11192: test_socket fails + +* issue 11190: test_locale fails + +* issue 11193: test_subprocess fails + +* issue 9920: minor arithmetic issues in cmath + +* issue 11215: test_fileio fails + +* issue 11188: test_time fails + + +====================================================================== + Implementation details for developers +---------------------------------------------------------------------- + +Python and python modules can now be built as shared libraries on AIX +as usual. + +AIX shared libraries require that an "export" and "import" file be +provided at compile time to list all extern symbols which may be +shared between modules. The "export" file (named python.exp) for the +modules and the libraries that belong to the Python core is created by +the "makexp_aix" script before performing the link of the python +binary. It lists all global symbols (exported during the link) of the +modules and the libraries that make up the python executable. + +When shared library modules (.so files) are made, a second shell +script is invoked. This script is named "ld_so_aix" and is also +provided with the distribution in the Modules subdirectory. This +script acts as an "ld" wrapper which hides the explicit management of +"export" and "import" files; it adds the appropriate arguments (in the +appropriate order) to the link command that creates the shared module. +Among other things, it specifies that the "python.exp" file is an +"import" file for the shared module. + +This mechanism should be transparent. diff --git a/configure b/configure index 90efcea4715..cc86b96926a 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 88560 . +# From configure.in Revision: 88561 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for python 3.1. # @@ -6408,6 +6408,13 @@ fi if test "$use_lfs" = "yes"; then # Two defines needed to enable largefile support on various platforms # These may affect some typedefs +case $ac_sys_system/$ac_sys_release in +AIX*) + +$as_echo "#define _LARGE_FILES 1" >>confdefs.h + + ;; +esac $as_echo "#define _LARGEFILE_SOURCE 1" >>confdefs.h diff --git a/configure.in b/configure.in index a24e54b36df..d1833be836b 100644 --- a/configure.in +++ b/configure.in @@ -1395,6 +1395,12 @@ fi if test "$use_lfs" = "yes"; then # Two defines needed to enable largefile support on various platforms # These may affect some typedefs +case $ac_sys_system/$ac_sys_release in +AIX*) + AC_DEFINE(_LARGE_FILES, 1, + [This must be defined on AIX systems to enable large file support.]) + ;; +esac AC_DEFINE(_LARGEFILE_SOURCE, 1, [This must be defined on some systems to enable large file support.]) AC_DEFINE(_FILE_OFFSET_BITS, 64,