Steve Lorimer Steve Lorimer - 10 months ago 214
Linux Question

Application built with protobuf 2.6 cannot run on Ubuntu 17.10

I have a Qt 5 application which has a dependency on protobuf 2.6.

Having upgraded to Ubuntu 17.10 I am no longer able to run it.


[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".)



When building my app, I am linking against the static version of protobuf,
libprotobuf.a
, which I guess is the 2.6.1 version mentioned in the error message.

However, by default, protobuf 3 is installed:

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]


I see
mir_protobuf
mentioned in the error, and that
libmirprotobuf3
package is installed.

A back trace shows
/usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3
is being found and loaded.

#0 __GI_raise ([email protected]=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 ([email protected]=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>, [email protected]=1, [email protected]=0x7ffe60c11c28, [email protected]=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 ([email protected]=0x55c5724d2800, argc=1, argv=0x7ffe60c11c28, env=0x7ffe60c11c38) at dl-init.c:120
#14 0x00007f56f9cdeb86 in dl_open_worker ([email protected]=0x7ffe60c11110) at dl-open.c:575
#15 0x00007f56f7605d64 in __GI__dl_catch_error ([email protected]=0x7ffe60c11100, [email protected]=0x7ffe60c11108, [email protected]=0x7ffe60c110ff, [email protected]=0x7f56f9cde7a0 <dl_open_worker>, [email protected]ntry=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 ([email protected]=0x7ffe60c11320) at dlopen.c:66
#18 0x00007f56f7605d64 in __GI__dl_catch_error ([email protected]=0x55c5724503d0, [email protected]=0x55c5724503d8, [email protected]=0x55c5724503c8, [email protected]=0x7f56f5f29fa0 <dlopen_doit>, [email protected]=0x7ffe60c11320)
at dl-error-skeleton.c:198
#19 0x00007f56f5f2a759 in _dlerror_run ([email protected]=0x7f56f5f29fa0 <dlopen_doit>, [email protected]=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


Upgrading my app to use protobuf 3 is not a possibility at this moment in time.

Is it possible to run my app on Ubuntu 17.10?

Answer Source

Because of the way dynamic linking works on Linux, it's only possible to have one version of the protobuf library loaded into any process. Because you are statically linking against libprotobuf, your statically-linked version is "winning" over any other version that might be in the dependency tree.

It looks like you are also linking against libmirprotobuf3.so, which is a library containing protobuf definitions for Mir. That library in turn specifies a dependency on libprotobuf.so (or libprotobuf-lite.so, it looks like). That dependency is being totally overridden my your statically-linked copy.

However, libmirprotobuf3.so was built against protobuf 3.0.0. It cannot use any other version. Since you're forcing it to try to use protobuf 2.6.1, it fails.

Your only two options are:

  1. Update your app to protobuf 3.0.0.
  2. Avoid linking against libmirprotobuf3.so.

Upgrading my app to use protobuf 3 is not a possibility at this moment in time.

Why not? Version 3 of the protobuf library is backwards-compatible with programs written using version 2 of the protobuf lanugage. The new proto3 "features" (or lack of features) only apply if you opt in using syntax = "proto3";; as long as you don't do that, you shouldn't need to make any changes. You will of course need to regenerate your .pb.cc and .pb.h files using version 3 of protoc, but hopefully your makefiles do that automatically.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download