Skip to content

error: This file was generated by an older version of protoc #791

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

Open
yurivict opened this issue Feb 3, 2023 · 6 comments
Open

error: This file was generated by an older version of protoc #791

yurivict opened this issue Feb 3, 2023 · 6 comments
Assignees

Comments

@yurivict
Copy link

yurivict commented Feb 3, 2023

Build fails for opencv-contrib-python-4.7.0.68:

In file included from /usr/ports/graphics/py-opencv-contrib-python/work-py39/opencv-contrib-python-4.7.0.68/opencv/modules/dnn/misc/tensorflow/attr_value.pb.cc:4:
/usr/ports/graphics/py-opencv-contrib-python/work-py39/opencv-contrib-python-4.7.0.68/opencv/modules/dnn/misc/tensorflow/attr_value.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^

All headers generated by protobuf should be regenerated during build. They can't be reused.

@asmorkalov
Copy link
Collaborator

OpenCV uses own instance of Protobuf to handle ONNX, Caffe and some other DNN formats. Your error message means that you have yet another Protobuf instance in your build configuration. Please disable OpenCV DNN or use the same version everywhere.

@alalek
Copy link
Member

alalek commented Feb 6, 2023

Issue reports without complete reproducer are useless.

All headers generated by protobuf should be regenerated during build. They can't be reused.

BUILD_PROTOBUF=OFF (to use external version) is almost useless without UPDATE_PROTO_FILES=ON option.
There are multiple similar questions in the upstream repository.

@yurivict
Copy link
Author

yurivict commented Feb 6, 2023

BUILD_PROTOBUF=OFF (to use external version) is almost useless without UPDATE_PROTO_FILES=ON option.

Maybe you should make this behavior default?

@yurivict
Copy link
Author

yurivict commented Feb 6, 2023

Adding -DBUILD_PROTOBUF=ON -DUPDATE_PROTO_FILES=ON to cmake arguments in setup.py doesn't fix the error This file was generated by an older version of protoc which is

@alalek
Copy link
Member

alalek commented Feb 6, 2023

-DBUILD_PROTOBUF=ON -DUPDATE_PROTO_FILES=ON

Wrong usage.
The first is the default value.
The second must be OFF in that case.

Don't touch these parameters if you don't want to use system's protobuf.

We have no idea that you are doing as we don't see any reproducer.


Dump compiler command line with all parameters.
Add -H option to show used headers.
Ensure that there is no mess with system's protobuf headers.

@asmorkalov
Copy link
Collaborator

The flag was renamed. Current version uses -DPROTOBUF_UPDATE_FILES=ON. Added the case to FAQ on Wiki.

@asmorkalov asmorkalov self-assigned this Oct 12, 2023
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

No branches or pull requests

3 participants