Skip to content
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

Protobuf Version Mismatch Fix Guide #736

Open
naoNao89 opened this issue Aug 30, 2024 · 1 comment
Open

Protobuf Version Mismatch Fix Guide #736

naoNao89 opened this issue Aug 30, 2024 · 1 comment

Comments

@naoNao89
Copy link

The error you're encountering is due to a version mismatch between the protobuf crate and the onnx-protobuf crate. Specifically:

  • Your project is using protobuf version 3.5.1
  • The onnx-protobuf crate (version 0.2.3) was compiled against protobuf version 3.4.0

This mismatch causes the error:

cannot find value `VERSION_3_4_0` in crate `protobuf`
  --> .cargo/registry/src/index.crates.io-6f17d22bba15001f/onnx-protobuf-0.2.3/src/proto/onnx.rs:27:47
   |
27 | const _PROTOBUF_VERSION_CHECK: () = protobuf::VERSION_3_4_0;
   |                                               ^^^^^^^^^^^^^ help: a constant with a similar name exists: `VERSION_3_5_1`
   |
  ::: target/debug/build/protobuf-9067af482d19c48e/out/version.rs:7:1
   |
7  | pub const VERSION_3_5_1: () = ();
   | --------------------------- similarly named constant `VERSION_3_5_1` defined here

Resolution Steps

  1. Locate the onnx.rs file:
    Path: .cargo/registry/src/index.crates.io-6f17d22bba15001f/onnx-protobuf-0.2.3/src/proto/onnx.rs

  2. Open onnx.rs in a text editor.

  3. Find this line:

    const _PROTOBUF_VERSION_CHECK: () = protobuf::VERSION_3_4_0;
  4. Change it to:

    const _PROTOBUF_VERSION_CHECK: () = protobuf::VERSION_3_5_1;
  5. Save the file.

  6. Clean and rebuild your project:

    cargo clean
    cargo build
    

Important Notes

  • This is a temporary fix. The change will be overwritten when you update your dependencies.
  • A more permanent solution would involve updating onnx-protobuf to a version compatible with protobuf 3.5.1, or pinning protobuf to version 3.4.0 in your Cargo.toml.
@plusvic
Copy link
Contributor

plusvic commented Sep 7, 2024

I think this issue should be reported to the authors of the onnx-protobuf crate. The issue doesn't belong to this project.

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

2 participants