|
| 1 | +Subject: HERE IS AIX-NOTES |
| 2 | +From: Manus Hand < [email protected]> |
| 3 | +To: Guido van Rossum < [email protected]> |
| 4 | + |
| 5 | +Date: Thu, 8 Aug 1996 16:11:10 -0600 (MDT) |
| 6 | + |
| 7 | +============================================================================== |
| 8 | + COMPILER INFORMATION |
| 9 | +------------------------------------------------------------------------------ |
| 10 | + |
| 11 | +(1) A problem has been reported with "make test" failing because of "weird |
| 12 | + indentation." Searching the comp.lang.python newsgroup reveals several |
| 13 | + threads on this subject, and it seems to be a compiler bug in an old |
| 14 | + version of the AIX CC compiler. However, the compiler/OS combination |
| 15 | + which has this problem is not identified. In preparation for the 1.4 |
| 16 | + release, Vladimir Marangozov ( [email protected]) and Manus Hand |
| 17 | + ( [email protected]) reported no such troubles for the following compilers and |
| 18 | + operating system versions: |
| 19 | + AIX C compiler version 3.1.2 on AIX 4.1.3 and AIX 4.1.4 |
| 20 | + AIX C compiler version 1.3.0 on AIX 3.2.5 |
| 21 | + If you have this problem, please report the compiler/OS version. |
| 22 | + |
| 23 | +(2) Stefan Esser ( [email protected]), in work done to compile Python |
| 24 | + 1.0.0 on AIX 3.2.4, reports that AIX compilers don't like the LANG |
| 25 | + environment varaiable set to European locales. This makes the compiler |
| 26 | + generate floating point constants using "," as the decimal seperator, |
| 27 | + which the assembler doesn't understand (or perhaps it is the other way |
| 28 | + around, with the assembler expecting, but not getting "," in float |
| 29 | + numbers). "LANG=C; export LANG" solves the problem, as does |
| 30 | + "LANG=C $(MAKE) ..." in the master Makefile. |
| 31 | + |
| 32 | +(3) The cc (or xlc) compiler considers "Python/ceval.c" too complex to |
| 33 | + optimize, except when invoked with "-qmaxmem=4000" |
| 34 | + |
| 35 | +(4) Some problems (due to _AIX not being #defined) when python 1.0.0 was |
| 36 | + compiled using 'gcc -ansi' were reported by Stefan Esser, but were not |
| 37 | + investigated. |
| 38 | + |
| 39 | +(5) The cc compiler has internal variables named "__abs" and "__div". These |
| 40 | + names are reserved and may not be used as program variables in compiled |
| 41 | + source. (As an anecdote in support of this, the implementation of |
| 42 | + Python/operator.c had this problem in the 1.4 beta releases, and the |
| 43 | + solution was to re#define some core-source variables having these names, |
| 44 | + to give these python variables different names if the build is being done |
| 45 | + on AIX.) |
| 46 | + |
| 47 | +(6) As mentioned in the README, builds done immediately after previous builds |
| 48 | + (without "make clean" or "make clobber") sometimes fail for mysterious |
| 49 | + reasons. There are some unpredictable results when the configuration |
| 50 | + is changed (that is, if you "configure" with different parameters) or if |
| 51 | + intermediate changes are made to some files. Performing "make clean" or |
| 52 | + "make clobber" resolves the problems. |
| 53 | + |
| 54 | +============================================================================== |
| 55 | + THREAD SUPPORT |
| 56 | +------------------------------------------------------------------------------ |
| 57 | + |
| 58 | +AIX uses pthreads. However, as of AIX version 4, there are two (incompatible) |
| 59 | +types of pthreads on AIX: |
| 60 | + a) AIX DCE pthreads (on AIX 3.2.5) |
| 61 | + b) AIX 4 pthreads (on AIX 4.1 and up) |
| 62 | +Support has been added to Python to handle the distinction. |
| 63 | + |
| 64 | +The cc and gcc compilers do not initialize pthreads properly. The only |
| 65 | +compilers that can initialize pthreads properly are IBM *_r* compilers, |
| 66 | +which use the crt0_r.o module, and which invoke ld with the reentrant |
| 67 | +version of libc (libc_r). |
| 68 | + |
| 69 | +In order to enable thread support, follow these steps: |
| 70 | + 1. Uncomment the thread module in Modules/Setup |
| 71 | + 2. configure --without-gcc --with-thread ... |
| 72 | + 3. make CC="cc_r" OPT="-O -qmaxmem=4000" |
| 73 | + |
| 74 | +For example, to make with both threads and readline, use: |
| 75 | + ./configure --without-gcc --with-thread --with-readline=/usr/local/lib |
| 76 | + make CC=cc_r OPT="-O2 -qmaxmem=4000" |
| 77 | + |
| 78 | +If the "make" which is used ignores the "CC=cc_r" directive, one could alias |
| 79 | +the cc command to cc_r (for example, in C-shell, perform an "alias cc cc_r"). |
| 80 | + |
| 81 | +Vladimir Marangozov ( [email protected]) provided this information, |
| 82 | +and he reports that a cc_r build initializes threads properly and that all |
| 83 | +demos on threads run okay with cc_r. |
| 84 | + |
| 85 | +============================================================================== |
| 86 | + SHARED LIBRARY SUPPORT |
| 87 | +------------------------------------------------------------------------------ |
| 88 | + |
| 89 | +AIX shared library support was added to Python in the 1.4 release by Manus |
| 90 | +Hand ( [email protected]) and Vladimir Marangozov ( [email protected]). |
| 91 | + |
| 92 | +Python modules may now be built as shared libraries on AIX using the normal |
| 93 | +process of uncommenting the "*noconfig*" line in Modules/Setup.in before the |
| 94 | +build. There is one additional step required, and that is to also uncomment |
| 95 | +the line in Modules/Setup.in which reads |
| 96 | + LINKCC= makexp_aix python.exp "" $(MYLIBS) $(ADDOBJS) ; $(CC) |
| 97 | + |
| 98 | +AIX shared libraries require that an "export" and "import" file be provided |
| 99 | +at compile time to list all extern symbols which may be shared between |
| 100 | +modules. The effect of uncommenting the LINKCC line in Modules/Setup.in is |
| 101 | +to create the "export" file for the modules and the libraries that belong to |
| 102 | +the Python core. This is done by the "makexp_aix" script, which creates a |
| 103 | +file named python.exp before performing the link of the python binary. |
| 104 | + |
| 105 | +When shared library modules (.so files) are made, a second shell script |
| 106 | +is invoked. This script is named "ld_so_aix" and is also provided with |
| 107 | +the distribution in the Modules subdirectory. This script acts as an "ld" |
| 108 | +wrapper which hides the explicit management of "export" and "import" files; |
| 109 | +it adds the appropriate arguments (in the appropriate order) to the link |
| 110 | +command that creates the shared module. Among other things, it specifies |
| 111 | +that the "python.exp" file is an "import" file for the shared module. |
| 112 | + |
| 113 | +A default python.exp file is provided with the distribution. It will be |
| 114 | +overwritten (by the action of the makexp_aix script) if you build with shared |
| 115 | +libraries. The python.exp file which comes with the distribution contains |
| 116 | +all extern symbols of a completely statically build python executable. |
| 117 | +Any python.exp file which is created from a build of python with some of the |
| 118 | +modules linked as shared modules will obviously not list symbols from the now |
| 119 | +dynamic modules. The distributed python.exp is provided so that, with |
| 120 | +assistance from the ld_so_aix and makexp_aix scripts, shared extension |
| 121 | +modules may be added to an otherwise completely static python build. |
| 122 | + |
| 123 | +At the time of this writing, neither the python.exp file nor the makexp_aix |
| 124 | +or ld_so_aix scripts are installed by the make procedure, so you should |
| 125 | +remember to keep these and/or copy them to a different location for |
| 126 | +safekeeping if you wish to use them to add shared extension modules to |
| 127 | +python. However, if the make process has been updated since this writing, |
| 128 | +these files MAY have been installed for you during the make by the |
| 129 | +LIBAINSTALL rule, in which case the need to make safe copies is obviated. |
| 130 | + |
| 131 | +If you wish to add a shared extension module to the language, you would follow |
| 132 | +the steps given in the example below (the example adds the shared extension |
| 133 | +module "spam" to python): |
| 134 | + 1. Make sure that "ld_so_aix" and "makexp_aix" are in your path. |
| 135 | + 2. The "python.exp" file should be in the current directory. |
| 136 | + 3. Issue the following commands or include them in your Makefile: |
| 137 | + cc -c spammodule.c |
| 138 | + ld_so_aix cc spammodule.o -o spammodule.so |
| 139 | + |
| 140 | +For more detailed information on the shared library support, examine the |
| 141 | +contents of the "ld_so_aix" and "makexp_aix" scripts or refer to the AIX |
| 142 | +documentation. |
| 143 | + |
| 144 | +============================================================================== |
0 commit comments