使用 protobuf 2.6 构建的应用程序无法在 Ubuntu 17.10 上 运行
Application built with protobuf 2.6 cannot run on Ubuntu 17.10
我有一个依赖于 protobuf 2.6 的 Qt 5 应用程序。
已升级到 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".)
在构建我的应用程序时,我正在链接 protobuf 的静态版本,libprotobuf.a
,我猜这是错误消息中提到的 2.6.1 版本。
但是,默认情况下会安装 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]
我看到错误中提到了 mir_protobuf
,并且安装了 libmirprotobuf3
包。
回溯显示正在找到并加载 /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3
。
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f56f74e5f5d in __GI_abort () at abort.c:90
#2 0x00007f56f7e8c095 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007f56f7e89c86 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007f56f7e89cd1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007f56f7e89f14 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x000055c570b362c7 in google::protobuf::internal::LogMessage::Finish (this=this@entry=0x7ffe60c10c90) at google/protobuf/stubs/common.cc:195
#7 0x000055c570b36658 in google::protobuf::internal::LogFinisher::operator= (other=..., this=<optimized out>) at google/protobuf/stubs/common.cc:203
#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
#11 0x00007f56f9cd9a6a in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7ffe60c11c28, env=env@entry=0x7ffe60c11c38) at dl-init.c:72
#12 0x00007f56f9cd9b7b in call_init (env=0x7ffe60c11c38, argv=0x7ffe60c11c28, argc=1, l=<optimized out>) at dl-init.c:30
#13 _dl_init (main_map=main_map@entry=0x55c5724d2800, argc=1, argv=0x7ffe60c11c28, env=0x7ffe60c11c38) at dl-init.c:120
#14 0x00007f56f9cdeb86 in dl_open_worker (a=a@entry=0x7ffe60c11110) at dl-open.c:575
#15 0x00007f56f7605d64 in __GI__dl_catch_error (objname=objname@entry=0x7ffe60c11100, errstring=errstring@entry=0x7ffe60c11108, mallocedp=mallocedp@entry=0x7ffe60c110ff, operate=operate@entry=0x7f56f9cde7a0 <dl_open_worker>, args=args@entry=0x7ffe60c11110)
at dl-error-skeleton.c:198
#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
#17 0x00007f56f5f29ff6 in dlopen_doit (a=a@entry=0x7ffe60c11320) at dlopen.c:66
#18 0x00007f56f7605d64 in __GI__dl_catch_error (objname=objname@entry=0x55c5724503d0, errstring=errstring@entry=0x55c5724503d8, mallocedp=mallocedp@entry=0x55c5724503c8, operate=operate@entry=0x7f56f5f29fa0 <dlopen_doit>, args=args@entry=0x7ffe60c11320)
at dl-error-skeleton.c:198
#19 0x00007f56f5f2a759 in _dlerror_run (operate=operate@entry=0x7f56f5f29fa0 <dlopen_doit>, args=args@entry=0x7ffe60c11320) at dlerror.c:163
#20 0x00007f56f5f2a092 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#21 0x00007f56f840571c in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007f56f83feb45 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007f56f83ef068 in QFactoryLoader::instance(int) const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007f56f89b4c23 in QPlatformThemeFactory::create(QString const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x00007f56f89c2448 in QGuiApplicationPrivate::createPlatformIntegration() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#26 0x00007f56f89c2e3d in QGuiApplicationPrivate::createEventDispatcher() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#27 0x00007f56f8410b85 in QCoreApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007f56f89c48cf in QGuiApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007f56f9189289 in QApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
目前无法及时升级我的应用程序以使用 protobuf 3。
是否可以在 Ubuntu 17.10 运行 我的应用程序?
由于动态链接在 Linux 上的工作方式,只能将一个版本的 protobuf 库加载到任何进程中。因为您是针对 libprotobuf 进行静态链接,所以您的静态链接版本 "winning" 高于依赖树中可能存在的任何其他版本。
您似乎也在链接 libmirprotobuf3.so,这是一个包含 Mir 的 protobuf 定义的库。该库又指定了对 libprotobuf.so(或 libprotobuf-lite.so,它看起来像)的依赖。我的静态链接副本完全覆盖了这种依赖性。
但是,libmirprotobuf3.so 是针对 protobuf 3.0.0 构建的。它不能使用任何其他版本。因为你强迫它尝试使用 protobuf 2.6.1,它失败了。
您只有两个选择:
- 将您的应用更新到 protobuf 3.0.0。
- 避免链接到 libmirprotobuf3.so。
Upgrading my app to use protobuf 3 is not a possibility at this moment in time.
为什么不呢? protobuf 库的版本 3 向后兼容使用 protobuf 语言版本 2 编写的程序。新的 proto3 "features"(或缺少功能)仅在您选择使用 syntax = "proto3";
时适用;只要您不这样做,就不需要进行任何更改。您当然需要使用 protoc
的版本 3 重新生成 .pb.cc
和 .pb.h
文件,但希望您的 makefile 会自动执行此操作。
我有一个依赖于 protobuf 2.6 的 Qt 5 应用程序。
已升级到 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".)
在构建我的应用程序时,我正在链接 protobuf 的静态版本,libprotobuf.a
,我猜这是错误消息中提到的 2.6.1 版本。
但是,默认情况下会安装 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]
我看到错误中提到了 mir_protobuf
,并且安装了 libmirprotobuf3
包。
回溯显示正在找到并加载 /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3
。
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f56f74e5f5d in __GI_abort () at abort.c:90
#2 0x00007f56f7e8c095 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007f56f7e89c86 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007f56f7e89cd1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007f56f7e89f14 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x000055c570b362c7 in google::protobuf::internal::LogMessage::Finish (this=this@entry=0x7ffe60c10c90) at google/protobuf/stubs/common.cc:195
#7 0x000055c570b36658 in google::protobuf::internal::LogFinisher::operator= (other=..., this=<optimized out>) at google/protobuf/stubs/common.cc:203
#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
#11 0x00007f56f9cd9a6a in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7ffe60c11c28, env=env@entry=0x7ffe60c11c38) at dl-init.c:72
#12 0x00007f56f9cd9b7b in call_init (env=0x7ffe60c11c38, argv=0x7ffe60c11c28, argc=1, l=<optimized out>) at dl-init.c:30
#13 _dl_init (main_map=main_map@entry=0x55c5724d2800, argc=1, argv=0x7ffe60c11c28, env=0x7ffe60c11c38) at dl-init.c:120
#14 0x00007f56f9cdeb86 in dl_open_worker (a=a@entry=0x7ffe60c11110) at dl-open.c:575
#15 0x00007f56f7605d64 in __GI__dl_catch_error (objname=objname@entry=0x7ffe60c11100, errstring=errstring@entry=0x7ffe60c11108, mallocedp=mallocedp@entry=0x7ffe60c110ff, operate=operate@entry=0x7f56f9cde7a0 <dl_open_worker>, args=args@entry=0x7ffe60c11110)
at dl-error-skeleton.c:198
#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
#17 0x00007f56f5f29ff6 in dlopen_doit (a=a@entry=0x7ffe60c11320) at dlopen.c:66
#18 0x00007f56f7605d64 in __GI__dl_catch_error (objname=objname@entry=0x55c5724503d0, errstring=errstring@entry=0x55c5724503d8, mallocedp=mallocedp@entry=0x55c5724503c8, operate=operate@entry=0x7f56f5f29fa0 <dlopen_doit>, args=args@entry=0x7ffe60c11320)
at dl-error-skeleton.c:198
#19 0x00007f56f5f2a759 in _dlerror_run (operate=operate@entry=0x7f56f5f29fa0 <dlopen_doit>, args=args@entry=0x7ffe60c11320) at dlerror.c:163
#20 0x00007f56f5f2a092 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#21 0x00007f56f840571c in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007f56f83feb45 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007f56f83ef068 in QFactoryLoader::instance(int) const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007f56f89b4c23 in QPlatformThemeFactory::create(QString const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x00007f56f89c2448 in QGuiApplicationPrivate::createPlatformIntegration() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#26 0x00007f56f89c2e3d in QGuiApplicationPrivate::createEventDispatcher() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#27 0x00007f56f8410b85 in QCoreApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007f56f89c48cf in QGuiApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007f56f9189289 in QApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
目前无法及时升级我的应用程序以使用 protobuf 3。
是否可以在 Ubuntu 17.10 运行 我的应用程序?
由于动态链接在 Linux 上的工作方式,只能将一个版本的 protobuf 库加载到任何进程中。因为您是针对 libprotobuf 进行静态链接,所以您的静态链接版本 "winning" 高于依赖树中可能存在的任何其他版本。
您似乎也在链接 libmirprotobuf3.so,这是一个包含 Mir 的 protobuf 定义的库。该库又指定了对 libprotobuf.so(或 libprotobuf-lite.so,它看起来像)的依赖。我的静态链接副本完全覆盖了这种依赖性。
但是,libmirprotobuf3.so 是针对 protobuf 3.0.0 构建的。它不能使用任何其他版本。因为你强迫它尝试使用 protobuf 2.6.1,它失败了。
您只有两个选择:
- 将您的应用更新到 protobuf 3.0.0。
- 避免链接到 libmirprotobuf3.so。
Upgrading my app to use protobuf 3 is not a possibility at this moment in time.
为什么不呢? protobuf 库的版本 3 向后兼容使用 protobuf 语言版本 2 编写的程序。新的 proto3 "features"(或缺少功能)仅在您选择使用 syntax = "proto3";
时适用;只要您不这样做,就不需要进行任何更改。您当然需要使用 protoc
的版本 3 重新生成 .pb.cc
和 .pb.h
文件,但希望您的 makefile 会自动执行此操作。