簡體   English   中英

與boost-python鏈接會在PyCEGUI中產生未定義的引用

[英]Linking against boost-python yields undefined references in PyCEGUI

我正在嘗試編譯需要鏈接到boost-python的Python (CEGUI可以構建Python模塊,其編輯器依賴於此)。 所以我用--with-python構建了boost,它構建得很好。

但是,一旦鏈接了.pyd,我將獲得未定義的引用:

Linking CXX shared module ..\..\..\..\..\bin\PyCEGUI.pyd
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x97): undefined reference to `_imp___ZN5boost6python7objects10class_baseC2EPKcjPKNS0_9type_infoES4_'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x9c): undefined reference to `_imp___ZN5boost6python9converter8registry6insertEPFPvP7_objectEPFvS5_PNS1_30rvalue_from_python_stage1_dataEENS0_9type_infoEPFPK11_typeobjectvE
'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0xcc): undefined reference to `_imp___ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFSt4pairIPvS2_ES4_E'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0xf4): undefined reference to `_imp___ZN5boost6python7objects8add_castENS0_9type_infoES2_PFPvS3_Eb'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x1cd): undefined reference to `_imp___ZN5boost6python7objects17copy_class_objectERKNS0_9type_infoES4_'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x20d): undefined reference to `_imp___ZN5boost6python9converter8registry6insertEPFP7_objectPKvENS0_9type_infoEPFPK11_typeobjectvE'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x245): undefined reference to `_imp___ZN5boost6python7objects10class_base17set_instance_sizeEj'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x281): undefined reference to `_imp___ZN5boost6python7objects15function_objectERKNS1_11py_functionERKSt4pairIPKNS0_6detail7keywordES9_E'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x2f2): undefined reference to `_imp___ZN5boost6python7objects16add_to_namespaceERKNS0_3api6objectEPKcS5_S7_'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x348): undefined reference to `_imp___ZN5boost6python6detail13current_scopeE'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x4d1): undefined reference to `_imp___ZN5boost6python9converter8registry9push_backEPFPvP7_objectEPFvS5_PNS1_30rvalue_from_python_stage1_dataEENS0_9type_infoEPFPK11_typeobjectvE'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x636): undefined reference to `_imp___ZN5boost6python7objects16add_to_namespaceERKNS0_3api6objectEPKcS5_'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x1246): undefined reference to `_imp___ZN5boost6python6detail13current_scopeE'
CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):AbsoluteDim.pypp.cpp:(.text+0x1267): undefined reference to `_imp___ZN5boost6python6detail13current_scopeE'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: CMakeFiles\PyCEGUI.dir/objects.a(AbsoluteDim.pypp.cpp.obj):
bad reloc address 0x2 in section `.text$_ZN5boost6detail15sp_counted_baseD1Ev[__ZN5boost6detail15sp_counted_baseD1Ev]'
collect2.exe: error: ld returned 1 exit status
cegui\src\ScriptModules\Python\bindings\CMakeFiles\PyCEGUI.dir\build.make:6698: recipe for target 'bin/PyCEGUI.pyd' failed
mingw32-make[2]: *** [bin/PyCEGUI.pyd] Error 1
CMakeFiles\Makefile2:726: recipe for target 'cegui/src/ScriptModules/Python/bindings/CMakeFiles/PyCEGUI.dir/all' failed
mingw32-make[1]: *** [cegui/src/ScriptModules/Python/bindings/CMakeFiles/PyCEGUI.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

我的第一個假設是它不針對boost-python進行鏈接,但是CMake文件夾中的link.txt顯示如下:

“ C:\\ Coding \\ CMake 2.8 \\ bin \\ cmake.exe” -E刪除-f CMakeFiles \\ PyCEGUI.dir / objects.a C:\\ MinGW \\ bin \\ ar.exe cr CMakeFiles \\ PyCEGUI.dir / objects.a @ CMakeFiles \\ PyCEGUI.dir \\ objects1.rsp C:\\ MinGW \\ bin \\ g ++。exe -shared -o .......... \\ bin \\ PyCEGUI.pyd -Wl,-major-image-version, 0,-minor-image-version,0 -Wl,-整個存檔CMakeFiles \\ PyCEGUI.dir / objects.a -Wl,-no-whole-archive .......... \\ lib \\ libCEGUIBase-0.dll.a C:\\ Coding \\ boost_1_53_0 \\ lib \\ libboost_python-mgw48-mt-1_53.a C:\\ Python27 \\ libs \\ python27.lib C:\\ Coding \\ CEGUI \\ cegui \\ dependencies \\ lib \\ dynamic \\ libfreetype.dll.a C:\\ Coding \\ CEGUI \\ cegui \\ dependencies \\ lib \\ dynamic \\ libpcre.dll.a -lwinmm -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

因此boost-python是與之相關的。 我不確定這里可能是什么問題。 促進? CEGUI? MinGW的?...

原來,問題是我使用的是64位版本的Python。 我幾個月前下載了它,卻忘了這個小事實。

現在,MinGW只能編譯和使用32位庫,而不能混入64位。 這就是導致boost-python無法正確編譯的原因(這是一個奇跡,它確實編譯了),因此在鏈接時具有未定義的引用。

下載32位版本的Python並重新編譯boost解決了這些問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM