tonic icon indicating copy to clipboard operation
tonic copied to clipboard

When I'm using tonic_build with slight complex structure, the code generator display weird errors

Open fbrv opened this issue 3 years ago • 4 comments

Bug Report

When I'm using tonic_build with slight complex structure, the code generator display weird errors

Version

└── tonic v0.8.0 └── tonic-build v0.8.0

Platform

21.5.0 Darwin Kernel Version 21.5.0

Description

In my proto folder I have different type of subfolder each one containing multiple proto files with the same namespace. Now I want to import some of them into other and compile everything with tonic_build but I get weird errors. I created a PoC for the error, and the link to the GitHub repository is the following one: https://github.com/fbrv/failing-example-tonic

fbrv avatar Aug 08 '22 20:08 fbrv

@fbrv You need to include prost-types = "0.11" as a dependency for your project (in Cargo.toml).

Or you can add .compile_well_known_types(true) to your tonic_build::Builder.

I don't see the need for prost-typesmentioned in the top level tonic docs anywhere, although it is in the prost docs and README: https://github.com/tokio-rs/prost#using-prost-in-a-cargo-project

There is also a crate called tonic-types, but I don't know what that does. (-:

hds avatar Aug 09 '22 09:08 hds

Yeah, we could provide some better docs around this for sure.

LucioFranco avatar Aug 09 '22 16:08 LucioFranco

Yeah, better docs would be great :wink:

On my Fedora 36 box this fixed the issue for me: sudo dnf install protobuf protobuf-compiler protobuf-devel

g0hl1n avatar Aug 16 '22 08:08 g0hl1n

I would accept PRs fixing docs 😄

LucioFranco avatar Aug 16 '22 16:08 LucioFranco