[Matrix-SIG] LLNLDistribution12beta problem

Lee Taylor taylor@rhino.llnl.gov
Fri, 13 Aug 1999 15:29:53 -0700 (PDT)


I was compiling the LLNLDistribution12beta Numerical extension
into python (i.e. not as a shared library) on an alpha running
 OSF1 4.0 (OSF1 tc02 V4.0 878 alpha),
I ran into the following problem:

ranlib libpython1.5.a
ar: Warning: ignoring second definition of PyExtensionClassCAPI defined in archive
true
cd Modules;  gmake OPT="-g" VERSION="1.5" \
                prefix="/g/g17/taylor/python/beta12" exec_prefix="/g/g17/taylor/python/beta12" \
                LIBRARY=../libpython1.5.a link
gmake[1]: Entering directory `/g/g17/taylor/python/beta12/Python-1.5.2/Modules'
cc   python.o \
          ../libpython1.5.a   -lnet  -lm  -o python 
ld:
../libpython1.5.a(_numpymodule.o): PyExtensionClassCAPI: multiply defined

After looking around, it seems that DEFINE_EXTENSIONCLASS should not be defined
in _numpymodule.c or arrayobject.h. 
It is defined in ExtensionClass.c and then used in ExtensionClass.h as:

#ifdef DEFINE_EXTENSIONCLASS
struct ExtensionClassCAPIstruct *PyExtensionClassCAPI = NULL;
#else
extern struct ExtensionClassCAPIstruct *PyExtensionClassCAPI;
#endif

By defining DEFINE_EXTENSIONCLASS too many times more definitions are
created instead of declarations.

I also tried this on an IBM running AIX4.3, and both versions
(original and patched) seem to work.


*** old/_numpymodule.c  Fri Aug 13 12:05:07 1999
--- _numpymodule.c      Fri Aug 13 13:21:28 1999
***************
*** 1,7 ****
  #include "Python.h"
  
  #define _ARRAY_MODULE
- #define DEFINE_EXTENSIONCLASS
  #include "arrayobject.h"
  #include "ExtensionClassMacros.h"
  #define _UFUNC_MODULE
--- 1,6 ----


*** old/arrayobject.h   Fri Aug 13 12:04:57 1999
--- arrayobject.h       Fri Aug 13 13:21:51 1999
***************
*** 5,11 ****
  #endif
  
  #ifndef _ARRAY_MODULE
- #define DEFINE_EXTENSIONCLASS
  #ifdef COMPILING_NUMPY
  #include "ExtensionClassMacros.h"
  #else
--- 5,10 ----

Lee Taylor
ltaylor@llnl.gov