我一直在試圖讓我的項目運行,但我遇到了麻煩。經過很多調試,我已經縮小了問題範圍,但不知道如何繼續。加載Python共享庫時C++中的未定義符號
一些背景知識,我在C++代碼中使用python腳本。這在Python上有所記錄,我設法讓它在我的基本可執行文件中運行得很好。 #include和-lpython2.6,一切都很棒。
但是,從共享庫(.so)運行此python腳本時出現困難。該共享庫由仿真系統(OpenRAVE)「加載」爲「模塊」。系統使用稱爲SendCommand的「模塊」的虛擬方法與此模塊交互。模塊然後啓動一個boost :: thread,給python自己的線程,然後返回到模擬系統。然而,當蟒蛇開始導入它的模塊,因此加載其動態庫失敗,我下面的錯誤承擔因:
ImportError: /usr/lib/python2.6/dist-packages/numpy/core/multiarray.so: undefined symbol: _Py_ZeroStruct
我已經在我的可執行文件和共享庫運行LDD,有沒有一些人是一個區別。我也在上面的文件上運行nm -D,_Py_ZeroStruct確實沒有定義。如果你們想印出命令,我很樂意提供這些命令。任何意見將不勝感激,謝謝。
以下是完整的蟒蛇錯誤:
Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/numpy/__init__.py", line 130, in import add_newdocs File "/usr/lib/python2.6/dist-packages/numpy/add_newdocs.py", line 9, in from lib import add_newdoc File "/usr/lib/python2.6/dist-packages/numpy/lib/__init__.py", line 4, in from type_check import * File "/usr/lib/python2.6/dist-packages/numpy/lib/type_check.py", line 8, in import numpy.core.numeric as _nx File "/usr/lib/python2.6/dist-packages/numpy/core/__init__.py", line 5, in import multiarray ImportError: /usr/lib/python2.6/dist-packages/numpy/core/multiarray.so: undefined symbol: _Py_ZeroStruct Traceback (most recent call last): File "/home/constantin/workspace/OpenRAVE/src/grasp_behavior_2.py", line 3, in from openravepy import * File "/home/constantin/workspace/rospackages/openrave/lib/python2.6/site-packages/openravepy/__init__.py", line 35, in openravepy_currentversion = loadlatest() File "/home/constantin/workspace/rospackages/openrave/lib/python2.6/site-packages/openravepy/__init__.py", line 16, in loadlatest return _loadversion('_openravepy_') File "/home/constantin/workspace/rospackages/openrave/lib/python2.6/site-packages/openravepy/__init__.py", line 19, in _loadversion mainpackage = __import__("openravepy", globals(), locals(), [targetname]) File "/home/constantin/workspace/rospackages/openrave/lib/python2.6/site-packages/openravepy/_openravepy_/__init__.py", line 29, in from openravepy_int import * ImportError: numpy.core.multiarray failed to import