onnx2c icon indicating copy to clipboard operation
onnx2c copied to clipboard

installation issue ubuntu - Protocol Buffer version

Open forgi86 opened this issue 2 years ago • 4 comments
trafficstars

I get an error running:

$ make onnx2c

The error is triggered by the generated file onnx.pb.h and reads:

"This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer headers. Please update your headers."

Seems related to Protocol Buffer versione, mine is 3.12.4

Marco

forgi86 avatar Nov 19 '23 12:11 forgi86

This sounds quite strange. Like your libprotobuf and the protoc are of different versions. Which version of Ubuntu is this?

Does the versions of the following match:

  • pkg-config --modversion protobuf
  • protoc --version

And what is GOOGLE_PROTOBUF_VERSION defined as in the generated onnx.pb.h file (in root of the build directory)

If there is a mismatch between the two, maybe Ubuntu packages several versions of protobuf, and doesn't enforce consistency?

kraiskil avatar Nov 20 '23 22:11 kraiskil

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy

pkg-config --modversion protobuf 3.12.4

protoc --version libprotoc 3.20.1

There is no GOOGLE_PROTOBUF_VERSION #define in the file onnx.pb.h

forgi86 avatar Nov 21 '23 16:11 forgi86

That looks like the problem. I don't know protobuf closely, but I think the protoc and libprotobuf must be of the same version. onnx2c build system doesn't check for the versions, just takes whatever it finds first.

Can you install a newer libprotobuf or older protoc?

kraiskil avatar Nov 22 '23 18:11 kraiskil

OK I found my problem, I was using a conda environment which was masking my /usr/bin/protoc to another one with the wrong version 3.20.1. A $ conda deactivate before compilation solved my issue. Thanks for the hint!

forgi86 avatar Nov 23 '23 17:11 forgi86