Skip to content

Non-deterministic plugin resolution for protoc-gen-rust-grpc on Windows #2621

@ShyamSundhar1411

Description

@ShyamSundhar1411

Bug Report

Version

tonic v0.14.5
grpc v0.9.0-alpha.1
grpc-protobuf v0.9.0-alpha.1
grpc-protobuf-build v0.9.0-alpha.1

Platform

Windows 64-bit
rustc 1.88.0
cargo 1.88.0

Crates

grpc-protobuf-build
interop

Description

While building the interop crate on Windows, I ran into issues around resolving the bundled protoc / protoc-gen-rust-grpc binaries from grpc-protobuf-build.

The current helper functions construct tool paths as strings, which can be fragile across platforms. On Windows, making the paths explicit using PathBuf and appending the .exe suffix correctly allowed the build to locate the intended binaries and generate the expected outputs.

I expected the bundled tool paths to be constructed in a platform-safe way.

A possible improvement would be to construct these paths using PathBuf, for example:

PathBuf::from(env!("OUT_DIR"))
    .join("bin")
    .join(if cfg!(windows) { "protoc.exe" } else { "protoc" })

The same can be applied to the protoc-gen-rust-grpc plugin
Happy to open a PR if this approach aligns with the intended design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions