2010-12-03 82 views
2

我使用和开发它的wxWebConnect和Python绑定(请参见http://github.com/jonmmorgan/wxwebconnect/http://github.com/jonmmorgan/pywebconnect/)。这些已经建立在Linux之前。然而,当XRC处理器支持加载出错的.so文件时加入Python程序崩溃:Linux动态链接错误与wxWebConnect

undefined symbol: _ZN22wxWebControlXmlHandlerC1Ev 

库已建成并正确地在Mac OS X和Windows上运行以来的变化来做出支持XRC。

此问题的原因似乎是类wxWebControlXmlHandler(请参见https://github.com/jonmmorgan/wxwebconnect/blob/master/xh_webcontrol.cpp)的构造函数未包含在构建的共享对象文件中。在xh_webcontrol.o上运行nm显示该符号位于该对象文件的文本部分中,该对象文件是链接到该共享对象中的一个对象文件。但是,在共享对象文件上运行nm表明它是未定义的,这是导致崩溃的原因。

我不明白为什么构造函数没有被包含在共享对象文件中,因为它显然是必需的(我知道构造函数在webcontrol.cpp中调用)。这是否有很好的理由?有什么我可以或应该做的,强制构造函数被包含在共享对象文件中并导出?

命令用来建造(setuptools的生成):


gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/gtk/wc_wrap.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/gtk/wc_wrap.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/dom.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/dom.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/nsimpl.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/nsimpl.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/promptservice.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/promptservice.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/protocolhandler.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/protocolhandler.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/webcontrol.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/webcontrol.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/webframe.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/webframe.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/webprefs.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/webprefs.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/webconnect/xh_webcontrol.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/xh_webcontrol.o -pthread -O3 -pthread 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -Iinclude -Isrc -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -Icontrib/wc -Icontrib/wc/webconnect -I/usr/include/xulrunner-1.9.2.11 -I/usr/include/python2.6 -c contrib/wc/pyprotocolhandler.cpp -o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/pyprotocolhandler.o -pthread -O3 -pthread 
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/gtk/wc_wrap.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/dom.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/nsimpl.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/promptservice.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/protocolhandler.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/webcontrol.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/webframe.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/webprefs.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/webconnect/xh_webcontrol.o build-gtk2.unicode/temp.linux-i686-2.6/contrib/wc/pyprotocolhandler.o -L/usr/X11R6/lib -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8 -lwx_gtk2u_xrc-2.8 -o /home/jmmorgan/wxwebconnect/wxPython-src-2.8.11.0/wxPython/wx/_wc.so -pthread -Wl,-Bsymbolic-functions 
+0

你能告诉用于连接makefile文件?我找不到一个建筑共享库。 – 2010-12-03 15:51:36

+0

我使用Python setuptools。我会把它使用的命令。 – 2010-12-03 16:01:22

回答

1

尝试把你的目标文件中-Wl,--whole-archive-Wl,--no-whole-archive部分。

man ld

--whole-archive
For each archive mentioned on the command line after the --whole-archive option, include every object file in the archive in the link, rather than searching the archive for the required object files. This is normally used to turn an archive file into a shared library, forcing every object to be included in the resulting shared library. This option may be used more than once.

Two notes when using this option from gcc: First, gcc doesn't know about this option, so you have to use -Wl,-whole-archive. Second, don't forget to use -Wl,-no-whole-archive after your list of archives, because gcc will add its own list of archives to your link and you may not want this flag to affect those as well.