静态库中未定义的符号链接到动态库
Undefined symbol in static lib linked into dynamic library
这是我的问题:
在运行时,我的程序加载共享库无法加载一个,它说:
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,它将列出程序使用的所有共享库。
-
检查执行环境中的环境变量 LIBPATH/LD_PATH。并确保所有这些库都存在于该路径中
- 确保所有库文件都具有足够的权限
相关文章:
- 如果包含映射的静态库与可执行文件和动态库链接,静态映射(变量)是否会被多次释放?
- 体系结构x86_64的未定义符号:链接器错误
- 如何防止 CMake 在构建时(而不是在安装时)为共享库创建符号链接?
- 如何将空文件夹和符号链接添加到存档 - libarchive
- boost::存在符号链接不取消引用
- c++ ReadDirectoryChangesW on directory,带有目录的符号链接
- 如何将libc++与调试符号链接起来?
- 如何使用 GetFinalPathNameByHandle 解析指向本地目录的符号链接?
- 在可执行文件中使用带有符号链接的相对路径
- 架构x86_64的未定义符号链接constexpr std :: array
- 使用dlopen()的符号链接
- 可能的 GCC 链接器错误会导致将弱符号和局部符号链接在一起时出错
- 如何将GCC中的静态库与其他动态库链接
- g++ 编译:我可以链接到带有符号链接二进制文件的目录吗?
- 如何在目录上迭代并识别或省略NTFS连接(符号链接ish)
- 与两个符号链接.一个在存档文件中定义
- 单一实例对象的未解决外部符号链接错误
- C++隐藏的符号链接
- G 自定义动态库链接错误未定义符号
- 如何解决动态链接XCode项目到lib4cxx库时的单符号链接错误