pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.26k stars 625 forks source link

unable to run pants fmt :: in pants repo unless I manually install protoc #20666

Open jasonwbarnett opened 5 months ago

jasonwbarnett commented 5 months ago

Describe the bug

I was attempting to contribute to pants and found that on both Ubuntu 22.04 (x86_64) and Mac OS 14.3.1 (M2) I was unable to run pants fmt :: in this repository. It continued to fail doing some work. I read the error message and saw that it was complaining about missing protoc. So on Mac I ran brew install protoc and on Ubuntu 22.04 I ran apt install -y protobuf-compiler and after that it worked on both platforms.

Pants version N/A

OS Both Linux and Mac OS

huonw commented 5 months ago

Thanks for filing an issue.

This is, partly, because the Rust compilation happens outside Pants, and so it cannot provide the protocol compiler itself. Something like https://github.com/pantsbuild/pants/pull/19813 would solve likely allow solving this "properly", with an appropriate version of protoc set up automatically...

For now, though, we could potentially just fix the formatting of https://www.pantsbuild.org/2.18/docs/contributions/development/setting-up-pants#step-2-bootstrap-the-rust-engine (and maybe expand slightly), where this is called out but accidentally within a run-on paragraph:

  • PyEnv Providers that sometimes cause issues include: Ubuntu Deadsnakes You also need to have the protobuf compiler and LLVM clang installed. On Debian derivatives, these can be installed using apt install clang protobuf-compiler.

Is probably intended to be formatted as:

Providers that sometimes cause issues include:

  • Ubuntu Deadsnakes

You also need to have the protobuf compiler and LLVM clang installed. On Debian derivatives, these can be installed using apt install clang protobuf-compiler.

Relevant code:

https://github.com/pantsbuild/pants/blob/44a06c5825e294757fb1dfe5920ea4b81db56023/docs/docs/contributions/development/setting-up-pants.mdx#L39-L42

@jasonwbarnett are you in a position to submit an update?

tdyas commented 5 months ago

For context here, protobuf is used as part of the Remote Execution API client in the Rust code which is used in the remote execution and remote cache implementations. The tonic crate used to supply protoc but stopped doing that for software supply chain reasons. Thus, the need for developers to install protoc into their development environment.

This is not really a bug, just a fact of what needs to be setup in the development environment.