Py_InitModule4 with Djapian/Xapian

3.1k views Asked by At

I am trying to install Djapian on RedHat5 / Python2.6. I have already installed it successfully on my OSX 10.6 machine.

I have built and compiled Xapian and Djapian without issue for Py2.6. I then install the Python Bindings for Xapian and it works fine, however, if open the Python interpreter and type 'import xapian, or try including djapian in my Django app, I get the following error:

/usr/lib64/python2.6/site-packages/_xapian.so: undefined symbol: Py_InitModule4

In searching, I have seen this issue for several Modules not just Xapian, but i can't seem to find a good solution. I do have python-devel installed.

I am guessing the issue is on the Python side and not Xapian.

1

There are 1 answers

1
David On BEST ANSWER

In some configurations (i.e. when Py_DEBUG is defined) Py_InitModule4 does not have an implementation because of macro rewriting. It is meant to tell you that the ABI are not compatible. I had this issue when I tried to use the Py_Debug version with a release version of the executable. Make sure you are compiling to the same configurations (debug/release) on all your targets.

From the Python source in modsupport.h (Py_TRACE_REFS is defined in Py_DEBUG):

 /* When we are tracing reference counts, rename Py_InitModule4 so
    modules compiled with incompatible settings will generate a
    link-time error. */