Steve Lorimer Steve Lorimer - 2 months ago 65
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/] 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/

When building my app, I am linking against the static version of protobuf,
, 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
mentioned in the error, and that
package is installed.

A back trace shows
is being found and loaded.

#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/
#3 0x00007f56f7e89c86 in ?? () from /usr/lib/x86_64-linux-gnu/
#4 0x00007f56f7e89cd1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/
#5 0x00007f56f7e89f14 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/
#6 0x000055c570b362c7 in google::protobuf::internal::LogMessage::Finish (this=this@entry=0x7ffe60c10c90) at google/protobuf/stubs/
#7 0x000055c570b36658 in google::protobuf::internal::LogFinisher::operator= (other=..., this=<optimized out>) at google/protobuf/stubs/
#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/") at google/protobuf/stubs/
#9 0x00007f56e73dd2bb in mir::protobuf::protobuf_AddDesc_mir_5fprotobuf_2eproto() () from /usr/lib/x86_64-linux-gnu/
#10 0x00007f56e73d0109 in ?? () from /usr/lib/x86_64-linux-gnu/
#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/", 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/
#22 0x00007f56f83feb45 in ?? () from /usr/lib/x86_64-linux-gnu/
#23 0x00007f56f83ef068 in QFactoryLoader::instance(int) const () from /usr/lib/x86_64-linux-gnu/
#24 0x00007f56f89b4c23 in QPlatformThemeFactory::create(QString const&, QString const&) () from /usr/lib/x86_64-linux-gnu/
#25 0x00007f56f89c2448 in QGuiApplicationPrivate::createPlatformIntegration() () from /usr/lib/x86_64-linux-gnu/
#26 0x00007f56f89c2e3d in QGuiApplicationPrivate::createEventDispatcher() () from /usr/lib/x86_64-linux-gnu/
#27 0x00007f56f8410b85 in QCoreApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/
#28 0x00007f56f89c48cf in QGuiApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/
#29 0x00007f56f9189289 in QApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/

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, which is a library containing protobuf definitions for Mir. That library in turn specifies a dependency on (or, it looks like). That dependency is being totally overridden my your statically-linked copy.

However, 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

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 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