-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is proto_path of prost_build::compile_protos must be an exact prefix of the .proto file names? #734
Comments
I believe you need to prefix the protos with the path as well. In reality, prost just passes these flags to protoc so you should be able to reproduce the protoc error via the cli directly. Prost doesn't do anything special here. |
But the docs are saying that the files should be found in the include paths? It also seems to work for most of the people, but some seem to have some special configuration or whatever where the build fails. |
I mean prefixing with path is fine, but then we should also update the docs. |
The docs here seem correct to me https://docs.rs/prost-build/latest/prost_build/fn.compile_protos.html#arguments but if you have any adjustments you think make sense I would love a PR! I think we can close this issue for now since I think the main problem is resolved. |
I understand this like the files in |
Maybe its a protoc thing but from the cli help it doesn't specify:
So I the proto path is relative to the working directory that protoc is invoked from. Iirc this should be the path that cargo build is invoked. So its not relative to the includes path but relative to the process path. |
Now could it have changed between protoc versions, totally! But I am not aware of it changing but I have also not looked super deep either. |
Okay, then we just change the path to include the relative path to the file. |
Ok, I think we can close this then. |
Yeah, thank you for your help @LucioFranco |
Description:
I put my .proto file(bitswap.v1.2.0.proto) in src/schema, and write code as follows:
In my Cargo.toml, the build depandencies is:
When I compile with protoc3.0.0, the following error occurs:
But when i compile with protoc3.20.3, no error happen.
Is proto_path must be an exact prefix of the .proto file names? If it is, why it's ok when i use protoc3.20.3?
The text was updated successfully, but these errors were encountered: