Skip to content

fix(build): honor PROTOC when generating protobuf code - #4441

Merged
TaylorMutch merged 1 commit into
NVIDIA:mainfrom
politerealism:fix/3510-honor-protoc-env/politerealism
Oct 14, 2026
Merged

TaylorMutch merged 1 commit into
NVIDIA:mainfrom
politerealism:fix/3510-honor-protoc-env/politerealism

Conversation

@politerealism

Copy link
Copy Markdown
Contributor

Summary

Make the protobuf build scripts honor PROTOC. The openshell-core, openshell-server and openshell-sandbox-backend build scripts always used the vendored protoc binary and ignored PROTOC, so a distro build could not use its system compiler (#3510, item 10).

Related Issue

Contributes to #3510

Changes

  • crates/openshell-core/build.rs, crates/openshell-server/build.rs, crates/openshell-sandbox-backend/build.rs: when PROTOC is set, use it and let prost resolve the well-known includes (PROTOC_INCLUDE still applies). When PROTOC is unset, behavior is unchanged: the vendored compiler and include tree are used, along with the existing re-entry that removes PROTOC_INCLUDE.
  • Emit cargo:rerun-if-env-changed for PROTOC and PROTOC_INCLUDE so switching modes rebuilds.

All protos in the repo are plain proto3 and import only google/protobuf/{descriptor,duration,struct,timestamp}.proto.

Testing

Checked with Fedora 44's protoc 3.19.6 (protobuf-compiler and protobuf-devel), using cargo check on the three crates:

  • Nothing set (default, vendored): cargo clippy --all-targets -- -D warnings passes.
  • PROTOC and PROTOC_INCLUDE set to the Fedora files: builds.
  • PROTOC set, PROTOC_INCLUDE unset (protoc finds its own includes): builds.
  • Only PROTOC_INCLUDE set (vendored mode, existing workaround path): builds.
  • PROTOC=/nonexistent/protoc: fails with prost's "Could not find protoc", confirming the variable is honored and the vendored binary is not used silently.
  • cargo fmt --all -- --check passes.
  • Not tested: a full rpmbuild using this, or the unit test suite.
  • Open question, deliberately out of scope: the protoc-bin-vendored* crates ship prebuilt protoc binaries in the vendored source tree, which a distro build may still need to remove or avoid. A default-on cargo feature could address that if Fedora review requires it.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable): not applicable

The core, server, and sandbox-backend build scripts always used the vendored protoc binary and ignored PROTOC, so a distro build could not use its system compiler. When PROTOC is set, use it and let prost resolve the includes (PROTOC_INCLUDE still applies); otherwise behave exactly as before. Contributes to NVIDIA#3510.

Signed-off-by: politerealism <burdcat17@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@politerealism
politerealism marked this pull request as ready for review October 14, 2026 16:33
@pimlock

pimlock commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

/ok to test b1ba429

1 similar comment
@purp

purp commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

/ok to test b1ba429

@TaylorMutch
TaylorMutch added this pull request to the merge queue Oct 14, 2026
@politerealism politerealism mentioned this pull request Oct 14, 2026
2 of 37 tasks
Merged via the queue into NVIDIA:main with commit 64c5bcd Oct 14, 2026
78 checks passed
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

Successfully merging this pull request may close these issues.

4 participants