protobuf
protobuf copied to clipboard
Missing google/protobuf/runtime_version.h
What version of protobuf and what language are you using? Version: v27.2 through vcpkg using vcpkg install protobuf protobuf:x64-windows Language: C++
What operating system (Linux, Windows, ...) and version? Windows 11 What runtime / compiler are you using (e.g., python version or gcc version) MSVC 2022 v147 What did you do? Steps to reproduce the behavior:
- Generate code from schemas
- Try to use the generated code
What did you expect to see Code compiles What did you see instead? Missing google/protobuf/runtime_version.h Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs). error C1083: Cannot open include file: 'google/protobuf/runtime_version.h': No such file or directory Anything else we should know about your project / environment
Can you clarify how you got the version of protobuf? Looks like vcpkg only has up to 4.25.1 for protobuf? https://vcpkg.io/en/package/protobuf
I am experiencing the same issue. Installed via vcpkg, version v4.25.1.
Switching to a earlier version of protoc (25.1 works for me) downloaded from the release page solved the issue. The Readme indicates to install the runtime via vcpkg and download the compiler from the release page, but does not specify the version needs to match. As a user I did not expect the latest version of the compiler to not work with the runtime installed with the officially suggested method.
Our C++ cross version runtime policy documents that protoc/gencode version and runtime version must match: https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp
@Logofile We make some reference to this in the Binary Compatibility Warning section but could probably clarify this and link to this page in the C++ readme: https://github.com/protocolbuffers/protobuf/tree/main/src
Same issue.....
Yes, this was my mistake because of version mismatch. Unfortunately vcpkg does not include the runtime and I checked out the corresponding code but at some point I updated.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.
Facing same issue.
please suggest the work around for this.
working on Linux (Ubuntu 22)
protoc --version
libprotoc 29.0-dev
I have installed the protobuf using bazel build following the instructions in the link --> installation link error message:
[ 62%] Built target DefaultPublisher
...
...
...
/home/xyzw/build/deps/proto/xyzw/Attribute.pb.h:14:10: fatal error: google/protobuf/runtime_version.h: No such file or directory
14 | #include "google/protobuf/runtime_version.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake: *** [Makefile:91: all] Error 2
Also facing the same issue. vcpkg has protobuf, and on ubuntu libprotobuf-dev and protobuf-compiler are installed. How do you fix this?
I had the same problem on OSX when installing protobuf via homebrew; the secret is that for some reason on M1 systems, homebrew doesn't put the protobuf includes in /usr/include, and so you must use pkg-config --cflags to apply the right include paths or your build doesn't work.
I observe the same problem, for some reason after installation it does not find this header file
We suggest to try updating the protobuf library version to match the proto-compiler version.
There might be older protobuf library versions installed and somehow linked to the new gencode/protoc. This isn't compatible and will throw the error.
Please provide more details of how protobuf is being compiled and used, e.g. bazel cmake..?, so that we know how to update our installation guide.
For bazel, probably also try setting up the WORKSPACE file to use the more recent protobuf.
lastly, the fastest workaround might be downgrading the protoc version to < 27.0.
@shaod2 I will add information:
System: Debian GNU/Linux 11 (docker) Protocol version: libprotoc 27.0(I also tried 28.2) GRPC version: v1.67(also tried 1.65)
Connecting grpc via Cmake:
set(protobuf_MODULE_COMPATIBLE TRUE)
set(ABSL_ENABLE_INSTALL ON)
set(_PROTOBUF_LIBPROTOBUF libprotobuf)
message(STATUS "PROTOBUF_VERSION: " $PROTOBUF_VERSION)
include(FetchContent)
FetchContent_Declare(
gRPC
GIT_REPOSITORY https://github.com/grpc/grpc
GIT_TAG v1.67.0
)
Attempt 1: I downloaded the release locally and placed it on the path /usr/local 'include/*' and /usr/local bin/protocol, launched the protocol utility and after that an error appeared in the generated messages.
Attempt 2: I did everything according to the instructions https://github.com/protocolbuffers/protobuf/blob/main/src/README.md via bazel, after copying the /usr/local/bin files
Attempt 3: I found that the runtime_version.h file is not in the entire file system and in the project, but it is in the source protobuf file. I copied it and put it in the build folder at the path /build/_deps/grpc-src/third_party/protobuf/src/google/protobuf/runtime_version.h after that, the project began to be assembled, but fell on version checks.
#if PROTOBUF_VERSION != 5027000
#error "Protobuf C++ gencode is built with an incompatible version of"
#error "Protobuf C++ headers/runtime. See"
#error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp"
#endif
where PROTOBUF_VERSION = 5027000
I'm facing the same problem too. I'm using 28.3 on debian linux.
It's easy to reproduce with the following steps:
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip
$ unzip protoc-28.3-linux-x86_64.zip
$ bin/protoc -I=. --cpp_out=. addressbook.proto
$ g++ -I include/ addressbook.pb.cc -o addressbook.pb.o
(addressbook.proto is from the demo here) The last step will throws:
In file included from addressbook.pb.cc:6:
addressbook.pb.h:14:10: fatal error: google/protobuf/runtime_version.h: No such file or directory
14 | #include "google/protobuf/runtime_version.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
I'm going through the same problem as well. I'm trying to use protocol buffer in a C++ project on 64-bit Windows.
Error C1083 'google/protobuf/runtime_version.h': No such file or directory c:\src\samples\sample01\addressbook.pb.h, line:14
facing the same issue and i re-install the grpc&protobuf and regenerate the .proto file , it works
Thanks to all the responders for providing context for the issues that you're experiencing. This will help me to update the documentation with more specificity to help others avoid this issue.