Py_InitModule4 with Djapian/Xapian

纵然是瞬间 提交于 2019-12-12 21:03:35

问题


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:


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. */


来源:https://stackoverflow.com/questions/4959872/py-initmodule4-with-djapian-xapian

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!