【发布时间】:2014-12-04 11:15:00
【问题描述】:
这是我的问题:
在运行时我加载共享库的程序无法加载一个,它说:
libCommunicationModule.so: undefined symbol __builtin_delete
上下文:
- 编译器:gcc 3.4
- Linux Debian 4.0(旧东西......)
我有一个静态库:libtgi_cppd.a,我没有这个库的来源。
该库通过这些选项链接到共享库 libCommunicationModule.so
-Wl,-whole-archive -ltgi_cppd
我在__builtin_delete 上启用了-y 选项来检查:
libtgi_cppd.a(ClientAPI_cpp.o): reference to __builtin_delete
libtgi_cppd.a(ClientInterface.o): reference to __builtin_delete
libtgi_cppd.a(ClientAPI_cpp.o): reference to __builtin_delete
我尝试在-whole-archive之前和之后添加链接命令-lstdc++ -lgcc,没有变化。
$ nm libCommunicationModule.so | grep __builtin
结果总是这样:
U __builtin_delete
U __builtin_new
U __builtin_vec_new
我能做些什么来解决这个问题?
谢谢
需要的完整命令:
g++ -Wl,-y -Wl,__builtin_delete -Wl,--trace -Wl,-rpath,/usr/local/qt/lib -shared
-Wl,-soname,libCommunicationModule-x11-Debug.so.6 -Wl,-rpath,/home/sncf/AGC_IHM/AGC/Tms/Gui/Components/CommunicationModule/x11/Debug
-o libCommunicationModule-x11-Debug.so.6.0.1 x11/Debug/Obj/CommunicationModule-Build.o x11/Debug/Obj/CommunicationModuleFilesAutoGen.o x11/Debug/Obj/CommunicationModuleParamsAutoGen.o
x11/Debug/Obj/CommunicationModule.o
x11/Debug/Obj/CommunicationModuleAutoGen.o
x11/Debug/Obj/CommDebugDlg.o
x11/Debug/Obj/moc_CommunicationModule.o x11/Debug/Obj/moc_CommDebugDlg.o
-L/usr/local/qt/lib
-L/usr/X11R6/lib -lBuildInformations-x11-Debug
-lBagsLib-x11-Debug -lConfigParamsLib-x11-Debug
-lIniLib-x11-Debug -lModuleHandling-x11-Debug
-lGenericRuntimeInfoLib-x11-Debug
-lDebugLib-x11-Debug -lTCNLib-x11-Debug
-lGUITools-x11-Debug -lQtEventsLib-x11-Debug
-lPackUnpack-x11-Debug -L/home/sncf/AGC_IHM/AGC/Tms/Gui/ProjectLib/x11
-L/home/sncf/AGC_IHM/AGC/Tms/Gui/Components/AGCTCNClientAPI/2004.09.21/posix_linux_i586/lib
-lqt-mt -lXext -lX11 -lm -lpthread -Wl,-whole-archive -ltgi_cppd -lstdc++ -lgcc
【问题讨论】:
-
我刚刚用ldd查了一下,一切都很好,它访问系统库和特定应用程序库,权限都很好。
-
@dgrat 查看 nm 结果,我看到静态库是 gcc2_compiled(所以肯定是 2.95)。我检查了可以做些什么来实现兼容性。
-
完整显示您的链接命令和所有其他相关命令,所有选项、参数和标志都未经逐字编辑,请特别确保您从头到尾复制它们,而不会省略中间的任何内容.
-
@n-m 添加链接器命令。然后应用程序像插件一样加载共享库,我的未定义符号出现的地方。
-
-lstdc++ -lgcc 是当我没有想法的时候:)。我会尽快检查您的链接,我的公司代理目前正在阻止它。感谢您的帮助
标签: c++ shared-libraries static-libraries undefined-symbol