Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Make Protobuf Version Agree #272

Closed
xanderdunn opened this issue Jun 19, 2021 · 1 comment · Fixed by #246
Closed

How to Make Protobuf Version Agree #272

xanderdunn opened this issue Jun 19, 2021 · 1 comment · Fixed by #246

Comments

@xanderdunn
Copy link

This is better suited to GitHub's new discussion feature, it's a question on my understanding and usage of the library, not necessarily an issue with the library:

I just built tensorflow_cc with the steps in the README:

git clone https://github.com/FloopCZ/tensorflow_cc.git
cd tensorflow_cc/tensorflow_cc
mkdir build && cd build
cmake ..
make
sudo make install
sudo ldconfig

And add it to my CMakeLists.txt:

find_package(TensorflowCC REQUIRED)
target_link_libraries(SelfSupervisedModel PRIVATE TensorflowCC::TensorflowCC)

Compilation fails with these errors:

In file included from /usr/local/include/tensorflow/bazel-bin/tensorflow/include/tensorflow/core/platfo
rm/status.h:30,
                 from /usr/local/include/tensorflow/bazel-bin/tensorflow/include/tensorflow/core/lib/co
re/status.h:19,
                 from /usr/local/include/tensorflow/bazel-bin/tensorflow/include/tensorflow/core/util/e
vents_writer.h:22,
                 from /home/xander/dev/my_model/./include/ModelUtils.h:5,
                 from /home/xander/dev/my_model/./include/Loss.h:10,
                 from /home/xander/dev/my_model/src/MyModel.cpp:22:
/usr/local/include/tensorflow/bazel-bin/tensorflow/include/tensorflow/core/protobuf/error_codes.pb.h:17
:2: error: #error This file was generated by an older version of protoc which is
   17 | #error This file was generated by an older version of protoc which is
      |  ^~~~~
/usr/local/include/tensorflow/bazel-bin/tensorflow/include/tensorflow/core/protobuf/error_codes.pb.h:18
:2: error: #error incompatible with your Protocol Buffer headers. Please
   18 | #error incompatible with your Protocol Buffer headers. Please
      |  ^~~~~
/usr/local/include/tensorflow/bazel-bin/tensorflow/include/tensorflow/core/protobuf/error_codes.pb.h:19
:2: error: #error regenerate this file with a newer version of protoc.
   19 | #error regenerate this file with a newer version of protoc.
      |  ^~~~~

I've seen a handful of these reports across this project and it looks like the conclusion is that I simply need my system's protobuf to be the same version of protobuf that bazel used to build tensorflow. I'm happy to do this, but having difficulty figuring out how to.

First I thought I might be able to simply use the includes and libprotobuf.so produced by bazel, but I couldn't find them among the maze of bazel-out, bazel-bin, bazel-tensorflow, etc.

What version of prootbuf was tensorflow built with? From the error above, I find in the file /usr/local/include/tensorflow/bazel-bin/tensorflow/include/tensorflow/core/protobuf/error_codes.pb.h:

#if PROTOBUF_VERSION < 3009000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3009002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif

Is 3009000 protobuf version 3.9.0? If so, now I need to figure out how to install protobuf 3.9.0 on my system.

It looks like this is so old that my newer version of protobuf no longer supports it.

@xanderdunn
Copy link
Author

xanderdunn commented Jun 19, 2021

I was able to get past this by simply installing protobuf 3.9.0 on my system using wget https://github.com/protocolbuffers/protobuf/releases/download/v3.9.0/protobuf-cpp-3.9.0.zip and then building and installing it with the commands here.

Do you know why the protobuf version used here is so old? Mid 2019, almost two years old relative to the tensorflow release.

@FloopCZ FloopCZ linked a pull request Jun 29, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant