Guido van Rossum | bed266a | 1996-10-22 22:08:02 +0000 | [diff] [blame] | 1 | Subject: AIX-NOTES FOR 1.4 |
Guido van Rossum | 9dc7833 | 1996-08-09 14:38:40 +0000 | [diff] [blame] | 2 | From: Manus Hand <Manus.Hand@evolving.com> |
Guido van Rossum | 4742767 | 1996-11-27 19:38:00 +0000 | [diff] [blame] | 3 | To: guido@CNRI.Reston.VA.US |
| 4 | cc: Vladimir.Marangozov@imag.fr |
| 5 | Date: Fri, 25 Oct 1996 15:19:23 -0600 (MDT) |
Guido van Rossum | 9dc7833 | 1996-08-09 14:38:40 +0000 | [diff] [blame] | 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 (Vladimir.Marangozov@imag.fr) and Manus Hand |
| 17 | (mhand@csn.net) 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. |
Guido van Rossum | cbf1b9c | 1997-05-22 20:20:57 +0000 | [diff] [blame] | 22 | [Postscript: it has also been spotted on AIX 4.2.1 --Guido] |
Guido van Rossum | 9dc7833 | 1996-08-09 14:38:40 +0000 | [diff] [blame] | 23 | |
| 24 | (2) Stefan Esser (se@MI.Uni-Koeln.DE), in work done to compile Python |
| 25 | 1.0.0 on AIX 3.2.4, reports that AIX compilers don't like the LANG |
| 26 | environment varaiable set to European locales. This makes the compiler |
| 27 | generate floating point constants using "," as the decimal seperator, |
| 28 | which the assembler doesn't understand (or perhaps it is the other way |
| 29 | around, with the assembler expecting, but not getting "," in float |
| 30 | numbers). "LANG=C; export LANG" solves the problem, as does |
| 31 | "LANG=C $(MAKE) ..." in the master Makefile. |
| 32 | |
| 33 | (3) The cc (or xlc) compiler considers "Python/ceval.c" too complex to |
| 34 | optimize, except when invoked with "-qmaxmem=4000" |
| 35 | |
| 36 | (4) Some problems (due to _AIX not being #defined) when python 1.0.0 was |
| 37 | compiled using 'gcc -ansi' were reported by Stefan Esser, but were not |
| 38 | investigated. |
| 39 | |
| 40 | (5) The cc compiler has internal variables named "__abs" and "__div". These |
| 41 | names are reserved and may not be used as program variables in compiled |
| 42 | source. (As an anecdote in support of this, the implementation of |
| 43 | Python/operator.c had this problem in the 1.4 beta releases, and the |
| 44 | solution was to re#define some core-source variables having these names, |
| 45 | to give these python variables different names if the build is being done |
| 46 | on AIX.) |
| 47 | |
| 48 | (6) As mentioned in the README, builds done immediately after previous builds |
| 49 | (without "make clean" or "make clobber") sometimes fail for mysterious |
| 50 | reasons. There are some unpredictable results when the configuration |
| 51 | is changed (that is, if you "configure" with different parameters) or if |
| 52 | intermediate changes are made to some files. Performing "make clean" or |
| 53 | "make clobber" resolves the problems. |
| 54 | |
| 55 | ============================================================================== |
| 56 | THREAD SUPPORT |
| 57 | ------------------------------------------------------------------------------ |
| 58 | |
| 59 | AIX uses pthreads. However, as of AIX version 4, there are two (incompatible) |
| 60 | types of pthreads on AIX: |
| 61 | a) AIX DCE pthreads (on AIX 3.2.5) |
| 62 | b) AIX 4 pthreads (on AIX 4.1 and up) |
| 63 | Support has been added to Python to handle the distinction. |
| 64 | |
| 65 | The cc and gcc compilers do not initialize pthreads properly. The only |
| 66 | compilers that can initialize pthreads properly are IBM *_r* compilers, |
| 67 | which use the crt0_r.o module, and which invoke ld with the reentrant |
| 68 | version of libc (libc_r). |
| 69 | |
| 70 | In order to enable thread support, follow these steps: |
| 71 | 1. Uncomment the thread module in Modules/Setup |
| 72 | 2. configure --without-gcc --with-thread ... |
| 73 | 3. make CC="cc_r" OPT="-O -qmaxmem=4000" |
| 74 | |
| 75 | For example, to make with both threads and readline, use: |
| 76 | ./configure --without-gcc --with-thread --with-readline=/usr/local/lib |
| 77 | make CC=cc_r OPT="-O2 -qmaxmem=4000" |
| 78 | |
| 79 | If the "make" which is used ignores the "CC=cc_r" directive, one could alias |
| 80 | the cc command to cc_r (for example, in C-shell, perform an "alias cc cc_r"). |
| 81 | |
| 82 | Vladimir Marangozov (Vladimir.Marangozov@imag.fr) provided this information, |
| 83 | and he reports that a cc_r build initializes threads properly and that all |
| 84 | demos on threads run okay with cc_r. |
| 85 | |
| 86 | ============================================================================== |
| 87 | SHARED LIBRARY SUPPORT |
| 88 | ------------------------------------------------------------------------------ |
| 89 | |
| 90 | AIX shared library support was added to Python in the 1.4 release by Manus |
| 91 | Hand (mhand@csn.net) and Vladimir Marangozov (Vladimir.Marangozov@imag.fr). |
| 92 | |
Guido van Rossum | bed266a | 1996-10-22 22:08:02 +0000 | [diff] [blame] | 93 | Python modules may now be built as shared libraries on AIX using the normal |
Guido van Rossum | 4742767 | 1996-11-27 19:38:00 +0000 | [diff] [blame] | 94 | process of uncommenting the "*shared*" line in Modules/Setup.in before the |
Guido van Rossum | 9dc7833 | 1996-08-09 14:38:40 +0000 | [diff] [blame] | 95 | build. There is one additional step required, and that is to also uncomment |
| 96 | the line in Modules/Setup.in which reads |
| 97 | LINKCC= makexp_aix python.exp "" $(MYLIBS) $(ADDOBJS) ; $(CC) |
| 98 | |
| 99 | AIX shared libraries require that an "export" and "import" file be provided |
| 100 | at compile time to list all extern symbols which may be shared between |
| 101 | modules. The effect of uncommenting the LINKCC line in Modules/Setup.in is |
| 102 | to create the "export" file for the modules and the libraries that belong to |
| 103 | the Python core. This is done by the "makexp_aix" script, which creates a |
| 104 | file named python.exp before performing the link of the python binary. |
| 105 | |
| 106 | When shared library modules (.so files) are made, a second shell script |
| 107 | is invoked. This script is named "ld_so_aix" and is also provided with |
| 108 | the distribution in the Modules subdirectory. This script acts as an "ld" |
| 109 | wrapper which hides the explicit management of "export" and "import" files; |
| 110 | it adds the appropriate arguments (in the appropriate order) to the link |
| 111 | command that creates the shared module. Among other things, it specifies |
| 112 | that the "python.exp" file is an "import" file for the shared module. |
| 113 | |
| 114 | A default python.exp file is provided with the distribution. It will be |
| 115 | overwritten (by the action of the makexp_aix script) if you build with shared |
| 116 | libraries. The python.exp file which comes with the distribution contains |
Guido van Rossum | 5c8e256 | 1996-08-20 20:53:04 +0000 | [diff] [blame] | 117 | all extern symbols of a completely statically built python executable. |
Guido van Rossum | 9dc7833 | 1996-08-09 14:38:40 +0000 | [diff] [blame] | 118 | Any python.exp file which is created from a build of python with some of the |
| 119 | modules linked as shared modules will obviously not list symbols from the now |
| 120 | dynamic modules. The distributed python.exp is provided so that, with |
| 121 | assistance from the ld_so_aix and makexp_aix scripts, shared extension |
| 122 | modules may be added to an otherwise completely static python build. |
| 123 | |
| 124 | At the time of this writing, neither the python.exp file nor the makexp_aix |
| 125 | or ld_so_aix scripts are installed by the make procedure, so you should |
| 126 | remember to keep these and/or copy them to a different location for |
| 127 | safekeeping if you wish to use them to add shared extension modules to |
| 128 | python. However, if the make process has been updated since this writing, |
| 129 | these files MAY have been installed for you during the make by the |
| 130 | LIBAINSTALL rule, in which case the need to make safe copies is obviated. |
| 131 | |
| 132 | If you wish to add a shared extension module to the language, you would follow |
| 133 | the steps given in the example below (the example adds the shared extension |
| 134 | module "spam" to python): |
| 135 | 1. Make sure that "ld_so_aix" and "makexp_aix" are in your path. |
| 136 | 2. The "python.exp" file should be in the current directory. |
| 137 | 3. Issue the following commands or include them in your Makefile: |
| 138 | cc -c spammodule.c |
| 139 | ld_so_aix cc spammodule.o -o spammodule.so |
| 140 | |
| 141 | For more detailed information on the shared library support, examine the |
| 142 | contents of the "ld_so_aix" and "makexp_aix" scripts or refer to the AIX |
| 143 | documentation. |
| 144 | |
Guido van Rossum | bed266a | 1996-10-22 22:08:02 +0000 | [diff] [blame] | 145 | NOTE: If the extension module is written in C++ and contains templates, |
| 146 | an alternative to "ld_so_aix" is the /usr/lpp/xlC/bin/makeC++SharedLib |
| 147 | script. Chris Myers (myers@TC.Cornell.EDU) reports that ld_so_aix |
| 148 | works well for some C++ (including the C++ that is generated |
| 149 | automatically by the Python SWIG package [SWIG can be found at |
| 150 | http://www.cs.utah.edu/~beazley/SWIG/swig.html]). However, it is not |
| 151 | known whether makeC++SharedLib can be used as a complete substitute |
| 152 | for ld_so_aix. |
| 153 | |
Guido van Rossum | 9dc7833 | 1996-08-09 14:38:40 +0000 | [diff] [blame] | 154 | ============================================================================== |