Arch by default installs the latest protobuf which is incompatible due to removal of ReleaseCleared in v26 & above (as noted in #21308 ). So I install the protobuf-21 package which is the preferred version for ONNX. I then set the protoc path to ONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc-21 but then that fails because the build picks up the /usr/include/google/protobuf which is incompatible - the protobuf-21 package installs the includes into /usr/include/protobuf-21/google/protobuf so as not to conflict with any other version. I'm at a loss as to how to get ONNX to compile against the system protobuf-21 package (i.e. how do I override the protobuf library include path).
~/projects/onnxruntime/onnxruntime/core/graph/graph.cc:1291:58: error: ‘class google::protobuf::RepeatedPtrField<onnx::SparseTensorProto>’ has no member named ‘ReleaseCleared’
1291 | delete graph_proto_->mutable_sparse_initializer()->ReleaseCleared();
If building against protobuf-21 (--cmake_extra_defines ONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc-21)
In file included from ~/projects/onnxruntime/build/Linux/Debug/_deps/onnx-build/onnx/onnx-ml.pb.cc:4:
~/projects/onnxruntime/build/Linux/Debug/_deps/onnx-build/onnx/onnx-ml.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
12 | #error This file was generated by a newer version of protoc which is
| ^~~~~
~/projects/onnxruntime/build/Linux/Debug/_deps/onnx-build/onnx/onnx-ml.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
13 | #error incompatible with your Protocol Buffer headers. Please update
| ^~~~~
~/projects/onnxruntime/build/Linux/Debug/_deps/onnx-build/onnx/onnx-ml.pb.h:14:2: error: #error your headers.
14 | #error your headers.
| ^~~~~
Describe the issue
Arch by default installs the latest protobuf which is incompatible due to removal of ReleaseCleared in v26 & above (as noted in #21308 ). So I install the protobuf-21 package which is the preferred version for ONNX. I then set the protoc path to
ONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc-21
but then that fails because the build picks up the/usr/include/google/protobuf
which is incompatible - the protobuf-21 package installs the includes into/usr/include/protobuf-21/google/protobuf
so as not to conflict with any other version. I'm at a loss as to how to get ONNX to compile against the system protobuf-21 package (i.e. how do I override the protobuf library include path).Urgency
No response
Target platform
Arch Linux
Build script
Error / output
If building against normal protobuf,
If building against protobuf-21 (
--cmake_extra_defines ONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc-21
)Visual Studio Version
No response
GCC / Compiler Version
gcc-13