/Misc/AIX-NOTES

http://unladen-swallow.googlecode.com/ · #! · 155 lines · 126 code · 29 blank · 0 comment · 0 complexity · 0ec6e958c3746862fdc3eb7f3c6cd738 MD5 · raw file

  1. Subject: AIX - Misc/AIX-NOTES
  2. From: Vladimir Marangozov <Vladimir.Marangozov@imag.fr>
  3. To: guido@CNRI.Reston.Va.US (Guido van Rossum)
  4. Date: Wed, 6 Aug 1997 11:41:00 +0200 (EET)
  5. ==============================================================================
  6. COMPILER INFORMATION
  7. ------------------------------------------------------------------------------
  8. (1) A problem has been reported with "make test" failing because of "weird
  9. indentation." Searching the comp.lang.python newsgroup reveals several
  10. threads on this subject, and it seems to be a compiler bug in an old
  11. version of the AIX CC compiler. However, the compiler/OS combination
  12. which has this problem is not identified. In preparation for the 1.4
  13. release, Vladimir Marangozov (Vladimir.Marangozov@imag.fr) and Manus Hand
  14. (mhand@csn.net) reported no such troubles for the following compilers and
  15. operating system versions:
  16. AIX C compiler version 3.1.2 on AIX 4.1.3 and AIX 4.1.4
  17. AIX C compiler version 1.3.0 on AIX 3.2.5
  18. If you have this problem, please report the compiler/OS version.
  19. (2) Stefan Esser (se@MI.Uni-Koeln.DE), in work done to compile Python
  20. 1.0.0 on AIX 3.2.4, reports that AIX compilers don't like the LANG
  21. environment varaiable set to European locales. This makes the compiler
  22. generate floating point constants using "," as the decimal separator,
  23. which the assembler doesn't understand (or perhaps it is the other way
  24. around, with the assembler expecting, but not getting "," in float
  25. numbers). "LANG=C; export LANG" solves the problem, as does
  26. "LANG=C $(MAKE) ..." in the master Makefile.
  27. (3) The cc (or xlc) compiler considers "Python/eval.cc" too complex to
  28. optimize, except when invoked with "-qmaxmem=4000"
  29. (4) Some problems (due to _AIX not being #defined) when python 1.0.0 was
  30. compiled using 'gcc -ansi' were reported by Stefan Esser, but were not
  31. investigated.
  32. (5) The cc compiler has internal variables named "__abs" and "__div". These
  33. names are reserved and may not be used as program variables in compiled
  34. source. (As an anecdote in support of this, the implementation of
  35. Python/operator.c had this problem in the 1.4 beta releases, and the
  36. solution was to re#define some core-source variables having these names,
  37. to give these python variables different names if the build is being done
  38. on AIX.)
  39. (6) As mentioned in the README, builds done immediately after previous builds
  40. (without "make clean" or "make clobber") sometimes fail for mysterious
  41. reasons. There are some unpredictable results when the configuration
  42. is changed (that is, if you "configure" with different parameters) or if
  43. intermediate changes are made to some files. Performing "make clean" or
  44. "make clobber" resolves the problems.
  45. ==============================================================================
  46. THREAD SUPPORT
  47. ------------------------------------------------------------------------------
  48. As of AIX version 4, there are two (incompatible) types of pthreads on AIX:
  49. a) AIX DCE pthreads (on AIX 3.2.5)
  50. b) AIX 4 pthreads (on AIX 4.1 and up)
  51. Support has been added to Python to handle the distinction.
  52. The cc and gcc compilers do not initialize pthreads properly. The only
  53. compilers that can initialize pthreads properly are IBM *_r* compilers,
  54. which use the crt0_r.o module, and which invoke ld with the reentrant
  55. version of libc (libc_r).
  56. In order to enable thread support, follow these steps:
  57. 1. Uncomment the thread module in Modules/Setup
  58. 2. configure --without-gcc --with-thread ...
  59. 3. make CC="cc_r" OPT="-O -qmaxmem=4000"
  60. For example, to make with both threads and readline, use:
  61. ./configure --without-gcc --with-thread --with-readline=/usr/local/lib
  62. make CC=cc_r OPT="-O2 -qmaxmem=4000"
  63. If the "make" which is used ignores the "CC=cc_r" directive, one could alias
  64. the cc command to cc_r (for example, in C-shell, perform an "alias cc cc_r").
  65. Vladimir Marangozov (Vladimir.Marangozov@imag.fr) provided this information,
  66. and he reports that a cc_r build initializes threads properly and that all
  67. demos on threads run okay with cc_r.
  68. ==============================================================================
  69. SHARED LIBRARY SUPPORT
  70. ------------------------------------------------------------------------------
  71. AIX shared library support was added to Python in the 1.4 release by Manus
  72. Hand (mhand@csn.net) and Vladimir Marangozov (Vladimir.Marangozov@imag.fr).
  73. Python modules may now be built as shared libraries on AIX using the normal
  74. process of uncommenting the "*shared*" line in Modules/Setup before the
  75. build.
  76. AIX shared libraries require that an "export" and "import" file be provided
  77. at compile time to list all extern symbols which may be shared between
  78. modules. The "export" file (named python.exp) for the modules and the
  79. libraries that belong to the Python core is created by the "makexp_aix"
  80. script before performing the link of the python binary. It lists all global
  81. symbols (exported during the link) of the modules and the libraries that
  82. make up the python executable.
  83. When shared library modules (.so files) are made, a second shell script
  84. is invoked. This script is named "ld_so_aix" and is also provided with
  85. the distribution in the Modules subdirectory. This script acts as an "ld"
  86. wrapper which hides the explicit management of "export" and "import" files;
  87. it adds the appropriate arguments (in the appropriate order) to the link
  88. command that creates the shared module. Among other things, it specifies
  89. that the "python.exp" file is an "import" file for the shared module.
  90. At the time of this writing, neither the python.exp file nor the makexp_aix
  91. or ld_so_aix scripts are installed by the make procedure, so you should
  92. remember to keep these and/or copy them to a different location for
  93. safekeeping if you wish to use them to add shared extension modules to
  94. python. However, if the make process has been updated since this writing,
  95. these files MAY have been installed for you during the make by the
  96. LIBAINSTALL rule, in which case the need to make safe copies is obviated.
  97. If you wish to add a shared extension module to the language, you would follow
  98. the steps given in the example below (the example adds the shared extension
  99. module "spam" to python):
  100. 1. Make sure that "ld_so_aix" and "makexp_aix" are in your path.
  101. 2. The "python.exp" file should be in the current directory.
  102. 3. Issue the following commands or include them in your Makefile:
  103. cc -c spammodule.c
  104. ld_so_aix cc spammodule.o -o spammodule.so
  105. For more detailed information on the shared library support, examine the
  106. contents of the "ld_so_aix" and "makexp_aix" scripts or refer to the AIX
  107. documentation.
  108. NOTE: If the extension module is written in C++ and contains templates,
  109. an alternative to "ld_so_aix" is the /usr/lpp/xlC/bin/makeC++SharedLib
  110. script. Chris Myers (myers@TC.Cornell.EDU) reports that ld_so_aix
  111. works well for some C++ (including the C++ that is generated
  112. automatically by the Python SWIG package [SWIG can be found at
  113. http://www.cs.utah.edu/~beazley/SWIG/swig.html]). However, it is not
  114. known whether makeC++SharedLib can be used as a complete substitute
  115. for ld_so_aix.
  116. According to Gary Hook from IBM, the format of the export file changed
  117. in AIX 4.2. For AIX 4.2 and later, a period "." is required on the
  118. first line after "#!". If python crashes while importing a shared
  119. library, you can try modifying the LINKCC variable in the Makefile.
  120. It probably looks like this:
  121. LINKCC= $(srcdir)/Modules/makexp_aix Modules/python.exp \"\" $(LIBRARY); $(PURIFY) $(CXX)
  122. You should modify the \"\" to be a period:
  123. LINKCC= $(srcdir)/Modules/makexp_aix Modules/python.exp . $(LIBRARY); $(PURIFY) $(CXX)
  124. Using a period fixed the problem in the snake farm. YMMV.
  125. This fix has been incorporated into Python 2.3.
  126. ==============================================================================