Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Protoc compiler has to be installed manually before building the repository #557

Closed
rafaeling opened this issue May 12, 2023 · 2 comments
Closed
Labels
documentation Improvements or additions to documentation PI12

Comments

@rafaeling
Copy link
Contributor

Documentation does not include Protoc compiler as prerequisite to build the repository:

https://github.com/eclipse/kuksa.val/blob/master/kuksa_databroker/README.md

@rafaeling rafaeling changed the title Protoc compiler should be installed manually before building the repository Protoc compiler has to be installed manually before building the repository May 12, 2023
@SebastianSchildt SebastianSchildt added the documentation Improvements or additions to documentation label May 16, 2023
@SebastianSchildt
Copy link
Contributor

Question: Do we want to "fix" it in documentation, or do we want to do it during build again?

@argerus
Copy link
Contributor

argerus commented May 17, 2023

There is a rather simple fix available. This will build protoc from source (as part of the protobuf-src crate). This will be cached locally and wouldn't affect build times with the exception of the first time it's built on a machine.

The only downside is that this (currently) wouldn't be cached by the CI, making it slower. Could still be worth the convenience (while waiting for a solution for the CI caching).

diff --git a/kuksa_databroker/databroker-proto/Cargo.toml b/kuksa_databroker/databroker-proto/Cargo.toml
index 88d4000..3289efb 100644
--- a/kuksa_databroker/databroker-proto/Cargo.toml
+++ b/kuksa_databroker/databroker-proto/Cargo.toml
@@ -24,4 +24,5 @@ prost = { workspace = true }
 prost-types = { workspace = true }
 
 [build-dependencies]
+protobuf-src = "1.1.0"
 tonic-build = { workspace = true, features = ["transport", "prost"] }
diff --git a/kuksa_databroker/databroker-proto/build.rs b/kuksa_databroker/databroker-proto/build.rs
index d3a70ac..d02a006 100644
--- a/kuksa_databroker/databroker-proto/build.rs
+++ b/kuksa_databroker/databroker-proto/build.rs
@@ -12,6 +12,7 @@
 ********************************************************************************/
 
 fn main() -> Result<(), Box<dyn std::error::Error>> {
+    std::env::set_var("PROTOC", protobuf_src::protoc());
     tonic_build::configure()
         .compile_well_known_types(false)
         .protoc_arg("--experimental_allow_proto3_optional")

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
documentation Improvements or additions to documentation PI12
Projects
None yet
Development

No branches or pull requests

3 participants