protocolbuffers / protocolbuffers/protobuf

Rust: automatically source the matching protoc-prebuilt in build.rs (at least opt-in behavior).

Open
#26,271 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

keep open rust
Dominant language
C++
Stars
72k
Forks
16.3k
Avg merge
1d 17h
Merged PRs (30d)
140

Description

Hi,
the version-check in the rust protobuf_codegen crate seams very strict (Equality).

https://github.com/protocolbuffers/protobuf/blob/f37611ef2ebae84cbbc337899bfa6c7c253dac56/rust/release_crates/protobuf_codegen/src/lib.rs#L157

The static assertion inserted into the generated code seams more reasonable:
https://github.com/protocolbuffers/protobuf/blob/f37611ef2ebae84cbbc337899bfa6c7c253dac56/rust/internal.rs#L94

The strict version check enforces a tight coupling between the versions used inside the crate, and the version of protoc on the system.

maybe also provide a way to automaticaly download the right protoc version. for example using the protoc-prebuilt crate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the version check in rust/release_crates/protobuf_codegen/src/lib.rs and the generated-code assertion in rust/internal.rs, then inspect the crate's build.rs. Compare the current coupling behavior with the proposed protoc-prebuilt approach and define the opt-in behavior, including how a matching protoc version would be selected and downloaded.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.