我有一个 Qt 应用程序,它静态链接到 protobuf 2.6。
当我尝试在 Ubuntu 17.10 上运行它时,启动时出现异常。
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.0.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/build/mir-y44crS/mir-0.28.0+17.10.20171011.1/ obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)
查看堆栈跟踪,我发现异常的来源是一个mir_protobuf.pb.cc
名为libmirprotobuf.so.3
#8 google::protobuf::internal::VerifyVersion (headerVersion=3000000, minLibraryVersion=<optimized out>, filename=0x7f56e740fb00 "/build/mir-y44crS/mir-0.28.0+17.10.20171011.1/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc") at google/protobuf/stubs/common.cc:61
#9 0x00007f56e73dd2bb in mir::protobuf::protobuf_AddDesc_mir_5fprotobuf_2eproto() () from /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3
#10 0x00007f56e73d0109 in ?? () from /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3
在堆栈跟踪中,我发现 Qt 正在通过以下方式调用它:libqgtk3.so
#16 0x00007f56f9cde0d9 in _dl_open (file=0x55c572496638 "/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so", mode=-2147479551, caller_dlopen=0x7f56f840571c, nsid=-2, argc=<optimized out>, argv=<optimized out>, env=0x7ffe60c11c38) at dl-open.c:660
...
#23 0x00007f56f83ef068 in QFactoryLoader::instance(int) const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
Ubuntu 17.10 默认安装了 protobuf 3
libmirprotobuf3/artful,now 0.28.0+17.10.20171011.1-0ubuntu1 amd64 [installed,automatic]
libprotobuf-dev/artful,now 3.0.0-9ubuntu5 amd64 [installed]
libprotobuf-lite10/artful,now 3.0.0-9ubuntu5 amd64 [installed,automatic]
libprotobuf10/artful,now 3.0.0-9ubuntu5 amd64 [installed,automatic]
我的应用程序静态链接到 protobuf 2.6,但是这似乎会干扰libmirprotobuf.so.3
。
我可以在 Ubuntu 17.10 上运行我的应用程序吗?