'Compatibility issue with protobuf when compiling grpc/cpp/helloworld examples

I am trying to get gRpc version 1.44.0 to work on Fedora 35 (not sure OS is important).

I have build and installed gRpc following the instructions provided in the gRpc repo: https://github.com/grpc/grpc/tree/master/src/cpp

But when I try to run the helloworld example greeter client and server, I get the following error:

[libprotobuf FATAL /home/tools/Dev/libs/grpc/third_party/protobuf/src/google/protobuf/stubs/common.cc:87] This program was compiled against version 3.14.0 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.18.1).  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/wrappers.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  This program was compiled against version 3.14.0 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.18.1).  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/wrappers.pb.cc".)
Aborted (core dumped)

Which indicates that my installed protobuf version is 3.18.1 and I compiled against 3.14.0. However, when I check my installed packages, what I get from dnf is:

$ dnf info protobuf-devel
Installed Packages
Name         : protobuf-devel
Version      : 3.14.0
Release      : 7.fc35
Architecture : x86_64
Size         : 2.5 M
Source       : protobuf-3.14.0-7.fc35.src.rpm
Repository   : @System
From repo    : updates
Summary      : Protocol Buffers C++ headers and libraries
URL          : https://github.com/protocolbuffers/protobuf
License      : BSD
Description  : This package contains Protocol Buffers compiler for all languages and
             : C++ headers and libraries

Available Packages
Name         : protobuf-devel
Version      : 3.14.0
Release      : 7.fc35
Architecture : i686
Size         : 339 k
Source       : protobuf-3.14.0-7.fc35.src.rpm
Repository   : updates
Summary      : Protocol Buffers C++ headers and libraries
URL          : https://github.com/protocolbuffers/protobuf
License      : BSD
Description  : This package contains Protocol Buffers compiler for all languages and
             : C++ headers and libraries

and

$ dnf info protobuf
Last metadata expiration check: 0:00:58 ago on Mon 14 Mar 2022 11:31:16 AM CET.
Installed Packages
Name         : protobuf
Version      : 3.14.0
Release      : 7.fc35
Architecture : x86_64
Size         : 3.1 M
Source       : protobuf-3.14.0-7.fc35.src.rpm
Repository   : @System
From repo    : updates
Summary      : Protocol Buffers - Google's data interchange format
URL          : https://github.com/protocolbuffers/protobuf
License      : BSD
Description  : Protocol Buffers are a way of encoding structured data in an efficient
             : yet extensible format. Google uses Protocol Buffers for almost all of
             : its internal RPC protocols and file formats.
             : 
             : Protocol buffers are a flexible, efficient, automated mechanism for
             : serializing structured data – think XML, but smaller, faster, and
             : simpler. You define how you want your data to be structured once, then
             : you can use special generated source code to easily write and read
             : your structured data to and from a variety of data streams and using a
             : variety of languages. You can even update your data structure without
             : breaking deployed programs that are compiled against the "old" format.

Available Packages
Name         : protobuf
Version      : 3.14.0
Release      : 7.fc35
Architecture : i686
Size         : 1.0 M
Source       : protobuf-3.14.0-7.fc35.src.rpm
Repository   : updates
Summary      : Protocol Buffers - Google's data interchange format
URL          : https://github.com/protocolbuffers/protobuf
License      : BSD
Description  : Protocol Buffers are a way of encoding structured data in an efficient
             : yet extensible format. Google uses Protocol Buffers for almost all of
             : its internal RPC protocols and file formats.
             : 
             : Protocol buffers are a flexible, efficient, automated mechanism for
             : serializing structured data – think XML, but smaller, faster, and
             : simpler. You define how you want your data to be structured once, then
             : you can use special generated source code to easily write and read
             : your structured data to and from a variety of data streams and using a
             : variety of languages. You can even update your data structure without
             : breaking deployed programs that are compiled against the "old" format.

Unless something inside gRpc is forcing 3.18.1 I have no idea how there should be a 3.18.1 version. Additionally I tried following this: https://stackoverflow.com/a/41975050/936269 In a virtual machine by compiling protonbuf 3.18.1 from source and the installing it (make install), but I go the same error.

How to reproduce:

  1. Clone grpc
  2. Follow the build from source and installation procedure
  3. Follow the build of example guide
  4. Run the greeter_client or greeter_server
c++


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source