1

I write a C++ project and I use two "api library": API1 and API2.

API1 is depend libprotobuf.so.12 and API2 is depend libprotbuf.so.8.

I can make this project succussfully, but I got some error message when I run the excutable file.

    [libprotobuf FATAL google/protobuf/stubs/common.cc:78] This program was compiled against version 2.5.0 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.2.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 "google/protobuf/descriptor.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  This program was compiled against version 2.5.0 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.2.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 "google/protobuf/descriptor.pb.cc".)
Aborted (core dumped)

I have read this post, but I can't solve my problom.

yugr
  • 19,769
  • 3
  • 51
  • 96
Navy Cheng
  • 573
  • 4
  • 14
  • The protobuf version installed on the machine is newer (3.2.0) while the code is built against older version(2.5.0) hence the incompatibility. At run time the linker finds that the compiled binary is incompatible with the installed version of the run time library. Maybe, the API/function you are trying to use from the older version is also supported by the newer version as an overloaded function (if not deprecated) in which case you can compile the code against the latest version only and still be able to use the two versions. – dorKKnight Jun 28 '19 at 06:58
  • @dorKKnight Thank you for your suggenst. "API1" and "API2" is two binary shared library provided by tow different team, and I don't have the soruce code. So I can't compile "API1" and "API2" by myself. Can I assign which protobuf library version the API1/API2 link to? – Navy Cheng Jun 28 '19 at 08:01
  • [check these answers](https://stackoverflow.com/questions/43372047/link-two-different-version-of-protobuf-library-in-the-same-c-project) – dorKKnight Jun 28 '19 at 08:37
  • You could also play tricks with the namespace feature of `dlopen`, but that sounds pretty complex to use and maintain. – spectras Jun 28 '19 at 09:01

0 Answers0