Mir

Problem using Google Protocol Buffers Version 3

Asked by Anne Bruner on 2017-04-24

I am creating a Qt Application (Version 5.8) that uses Google Protocol Buffers Version 3.1.0 on Ubuntu 16.04. I am getting a protocol buffer version conflict during application load related to libmirclient/libmirprotobuf.

The Qt application loads libmirclient.so.9 which apparently requires protocol buffers version 2.6.1. My app requires version 3.1.0. When the application starts up, libprotobuf.so.11 (Version 3) is loaded and later libprotobuf-lite.so.9 (Version 2.6.1) is loaded.

The following error occurs calling init on /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3
Is there any way to get around this problem?

[libprotobuf FATAL google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.1.0). Contact the program author for an update. 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-pkdHET/mir-0.21.0+16.04.20160330/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what(): This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.1.0). Contact the program author for an update. 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-pkdHET/mir-0.21.0+16.04.20160330/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)

Question information

Language:
English Edit question
Status:
Answered
For:
Mir Edit question
Assignee:
No assignee Edit question
Last query:
2017-04-26
Last reply:
2017-08-16

The Mir version in any Ubuntu archive is built with the protobuf version in the archive. The version of protobuf in the Ubuntu 16.04 archive is 2.6.1.

The simplest option is to use libprotobuf-dev as supplied in the archive. If you need to use a more recent version, then you'll need to rebuild any packages that use it, including Mir.

Using a different archive won't help: Even the current 17.04 release only has 3.0.0 of protobuf.

Anne Bruner (annebruner) said : #2

Alan thank you for your response. A couple of follow up questions.

1. Where would I get the 17.04 version of mir?

2. Where would I go to get the source code and instructions to re-compile it myself?

Thanks,
Anne Bruner

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Alan Griffiths
Sent: Tuesday, April 25, 2017 4:54 AM
To: Anne Bruner <email address hidden>
Subject: Re: [Question #627463]: Problem using Google Protocol Buffers Version 3

Your question #627463 on Mir changed:
https://answers.launchpad.net/mir/+question/627463

    Status: Open => Answered

Alan Griffiths proposed the following answer:
The Mir version in any Ubuntu archive is built with the protobuf version in the archive. The version of protobuf in the Ubuntu 16.04 archive is 2.6.1.

The simplest option is to use libprotobuf-dev as supplied in the archive. If you need to use a more recent version, then you'll need to rebuild any packages that use it, including Mir.

Using a different archive won't help: Even the current 17.04 release only has 3.0.0 of protobuf.

--
If this answers your question, please go to the following page to let us know that it is solved:
https://answers.launchpad.net/mir/+question/627463/+confirm?answer_id=0

If you still need help, you can reply to this email or go to the following page to enter your feedback:
https://answers.launchpad.net/mir/+question/627463

You received this question notification because you asked the question.

confidentiality: This e-mail and its attachments are intended
for the above named only and may be confidential. If they have
come to you in error you must take no action based on them, nor
must you copy or show them to anyone; please reply to this e-
mail and highlight the error.

Security Warning: Please note that this e-mail has been created
in the knowledge that Internet e-mail is not a 100% secure
communications medium. We advise that you understand and observe
this lack of security when e-mailing us. Viruses: Although we
have taken steps to ensure that this e-mail and attachments are
free from any virus, we advise that in keeping with good
computing practice the recipient should ensure they are actually
virus free.

Anne Bruner (annebruner) said : #3

Thanks for your response. I decided to try building the mir code to see if that will work. I downloaded the source from the 'lp:mir' branch and following the build instructions. Part of the projects were built but then I received undefined reference errors trying to compile/link libmirclient and libmirclient-debug-extension.

Is there a different branch I should try building?

17.04 is an Ubuntu release, not a Mir release.

The lp:mir branch is current development and probably not ideal for your purposes, but I'm not aware of any reason it wouldn't link on Xenial. The branch lp:mir/0.21 corresponds to the Xenial release. I know that lp:mir/0.26 also builds correctly on Xenial.

Daniel van Vugt (vanvugt) said : #5

I just checked and lp:mir does build perfectly on pure xenial (protobuf 2). So this question is indeed just about using Protobuf 3 on xenial. I'm not sure I have any good answer to that. We have some existing bugs in the same area that may never get fixed...

Using libprotobuf and libprotobuf-lite (same version even) in the same process causes crashes:
  https://bugs.launchpad.net/mir/+bug/1535297

and mixing protobuf v2/v3 causes build failures:
  https://bugs.launchpad.net/mir/+bug/1652261

They're not exactly the same as the problem here though.

Manfred Hampl (m-hampl) said : #6

Where did you get libprotobuf.so.11 for xenial?
As far as I know the Ubuntu repositories only provide libprotobuf.so.9 for Ubuntu 16.04.

Anne Bruner (annebruner) said : #7

I built it from source.

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Manfred Hampl
Sent: Wednesday, April 26, 2017 2:54 AM
To: Anne Bruner <email address hidden>
Subject: Re: [Question #627463]: Problem using Google Protocol Buffers Version 3

Your question #627463 on Mir changed:
https://answers.launchpad.net/mir/+question/627463

Manfred Hampl requested more information:
Where did you get libprotobuf.so.11 for xenial?
As far as I know the Ubuntu repositories only provide libprotobuf.so.9 for Ubuntu 16.04.

--
To answer this request for more information, you can either reply to this email or enter your reply at the following page:
https://answers.launchpad.net/mir/+question/627463

You received this question notification because you asked the question.

confidentiality: This e-mail and its attachments are intended
for the above named only and may be confidential. If they have
come to you in error you must take no action based on them, nor
must you copy or show them to anyone; please reply to this e-
mail and highlight the error.

Security Warning: Please note that this e-mail has been created
in the knowledge that Internet e-mail is not a 100% secure
communications medium. We advise that you understand and observe
this lack of security when e-mailing us. Viruses: Although we
have taken steps to ensure that this e-mail and attachments are
free from any virus, we advise that in keeping with good
computing practice the recipient should ensure they are actually
virus free.

Manfred Hampl (m-hampl) said : #8

In that case you probably hit the problems listed by Daniel van Vugt.

Anne Bruner (annebruner) said : #9

I'm not sure. When I downloaded the lp:mir branch and tried to build, some of the libraries built successfully using the protobuf 3.1.0 versions but then I get linker errors listed below. However the library that was causing my app to abort during startup - namely 'libmirprotobuf.so.3' - was built. So I tried copying over that version to my app directory. The program does run and loads that version of libmirprotobuf.so.3 but I am getting linker map errors Not sure if these errors would disappear if I could get all the mir projects to build. At this point - I am sadly planning on reverting my app back to using protobuf 2.6.1

Here are the build errors I am getting. They seem to be related to the source files generated from the proto files using protoc. It does look like the build is using my 3.1.0 version of protoc and I am not getting an error when protoc runs.

Scanning dependencies of target mirclient-debug-extension
[ 56%] Building CXX object src/client/CMakeFiles/mirclient-debug-extension.dir/mir_debug_api.cpp.o
[ 56%] Linking CXX shared library ../../lib/libmirclient-debug-extension.so
libmirclient-static.a(mir_surface.cpp.o): In function `mir::protobuf::SurfaceId::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:9966: undefined reference to `mir::protobuf::SurfaceId_default_instance_'
collect2: error: ld returned 1 exit status
src/client/CMakeFiles/mirclient-debug-extension.dir/build.make:110: recipe for target 'lib/libmirclient-debug-extension.so.1' failed
make[2]: *** [lib/libmirclient-debug-extension.so.1] Error 1
CMakeFiles/Makefile2:4895: recipe for target 'src/client/CMakeFiles/mirclient-debug-extension.dir/all' failed
make[1]: *** [src/client/CMakeFiles/mirclient-debug-extension.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::StructuredError::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:7574: undefined reference to `mir::protobuf::StructuredError_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::SurfaceId::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:9966: undefined reference to `mir::protobuf::SurfaceId_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::BufferStreamId::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:10157: undefined reference to `mir::protobuf::BufferStreamId_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::Buffer::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:10904: undefined reference to `mir::protobuf::Buffer_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::ModuleProperties::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:11091: undefined reference to `mir::protobuf::ModuleProperties_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::Platform::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:11326: undefined reference to `mir::protobuf::Platform_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::BufferStream::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:12852: undefined reference to `mir::protobuf::BufferStream_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_connection.cpp.o: In function `mir::protobuf::DisplayConfiguration::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:13805: undefined reference to `mir::protobuf::DisplayConfiguration_default_instance_'
CMakeFiles/mirclientobjects.dir/mir_screencast.cpp.o: In function `mir::protobuf::ScreencastId::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:14763: undefined reference to `mir::protobuf::ScreencastId_default_instance_'
rpc/CMakeFiles/mirclientrpc.dir/mir_protobuf_rpc_channel.cpp.o: In function `mir::protobuf::BufferRequest::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:10594: undefined reference to `mir::protobuf::BufferRequest_default_instance_'
rpc/CMakeFiles/mirclientrpc.dir/mir_protobuf_rpc_channel.cpp.o: In function `mir::protobuf::LifecycleEvent::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:14011: undefined reference to `mir::protobuf::LifecycleEvent_default_instance_'
rpc/CMakeFiles/mirclientrpc.dir/mir_protobuf_rpc_channel.cpp.o: In function `mir::protobuf::PingEvent::internal_default_instance()':
/home/mitydsp/mir/mir26/0.26/build/src/protobuf/mir_protobuf.pb.h:14042: undefined reference to `mir::protobuf::PingEvent_default_instance_'
collect2: error: ld returned 1 exit status
src/client/CMakeFiles/mirclient.dir/build.make:216: recipe for target 'lib/libmirclient.so.9' failed
make[2]: *** [lib/libmirclient.so.9] Error 1
CMakeFiles/Makefile2:4940: recipe for target 'src/client/CMakeFiles/mirclient.dir/all' failed
make[1]: *** [src/client/CMakeFiles/mirclient.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

Manfred Hampl (m-hampl) said : #10

This now may be bug 1631597 (I have no idea how to tackle that)

Anne Bruner (annebruner) said : #11

Yes that looks like my problem. Thanks for the info. When I get bored I might try compiling the mir souce using protobuf 3.0.0 instead of 3.1.0. At least that would give us the capability of generating C# source from .proto files - which is a feature we are using.

If protobuf 3.0.0 is all you need, would upgrading Ubuntu to 17.04 be an option? protobuf 3.0.0 in the 17.04 archive and Mir is already built with it.

Anne Bruner (annebruner) said : #13

I had thought about that option but our company has a VM for development that is shared among many programmers that is based on 16.04. It is my understanding that 16.04 is a Long Term Support release while 17.04 is not.

Mathieu Benoit (mathben) said : #14

Hi, I am in the same situation, it's very hard to find any good solution.

I believe that the correct solution is to downgrade from proto file 3 to 2 but I don't really like the idea.

It is unacceptable to force people who use 16.04 to upgrade to 17.04 only to use the software.

I found that solution but it does not work for me: https://github.com/google/protobuf/issues/2979

Manfred Hampl (m-hampl) said : #15

@Mathieu Benoit:
Maybe your libprotbuf library archive is not in /usr/local/lib/libprotobuf.a but somewhere else. In that case you would have to adapt the related project.pro settings.

Can you help with this problem?

Provide an answer of your own, or ask Anne Bruner for more information if necessary.

To post a message you must log in.