Skip to content

protobuf-c no longer compiles against protobuf-2.6.1

This week I've been trying to build openairinterface5g from scratch again, and installing protobuf-c from source fails with:

  CXX      protoc-c/protoc_c_protoc_gen_c-c_file.o
  CXX      protoc-c/protoc_c_protoc_gen_c-c_generator.o
protoc-c/c_file.cc: In member function 'void google::protobuf::compiler::c::FileGenerator::GenerateHeader(google::protobuf::io::Printer*)':
protoc-c/c_file.cc:123:14: error: 'const class google::protobuf::FileDescriptor' has no member named 'syntax'
   if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
              ^
protoc-c/c_file.cc:123:26: error: 'SYNTAX_PROTO3' is not a member of 'google::protobuf::FileDescriptor'
   if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
                          ^
make: *** [protoc-c/protoc_c_protoc_gen_c-c_file.o] Error 1

Related to this github issue on protobuf-c.

It appears that since this change on Jul 29, protobuf-c doesn't compile against protobuf-2.6.1 anymore.

This patch against openairinterface5g works around the issue:

diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 29d839b..e5b3430 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -226,6 +226,7 @@ install_protobuf_c_from_source(){
     rm -rf /tmp/protobuf-c
     git clone https://github.com/protobuf-c/protobuf-c.git
     cd protobuf-c
+    git checkout 2a46af42784abf86804d536f6e0122d47cfeea45
     ./autogen.sh
     ./configure
     echo "Compiling protobuf-c"