Closed inge4pres closed 1 week ago
Maybe I'm also confused, apparently -I
is equivalent to --proto_path
, but when running protoc externally with the added flag it fails anyway π€·πΌ
Hello @inge4pres, thank you for your issue.
Using another generator with protoc, do you manage to generate the thing you'd like to to have using zig-protobuf ? Which flags were necessary for it?
We have an include_directory option in RunProtocStep, that should use the -I flag in the background.
If you have small project strapped of anything unnecessary that reproduces the problem, it'd give us more way to help you.
Also, with the verbose
flag, you should be able to see the exact protoc command used by RunProtocStep
Thanks again.
Also, with the
verbose
flag, you should be able to see the exact protoc command used byRunProtocStep
Hey @Arwalk thanks for the hint, the verbose
is not adding any more useful information to the already printed output.
Though I guess since it's failing to build even when calling protoc
directly, it's not an issue in this library but a problem in how protoc expects includes...
I will close this issue and post back once I find the solution to the protoc error ππΌ
I confirm the problem is not in zig-protobuf, rather in how include_directories
should be used when imports are declared in protobuf files.
protoc
requires that imports are expressed as relative paths to --proto_path
(or -I
).
For reference, the solution for me was to use include_directories
as follows:
.include_directories = &.{
"proto-src/",
},
In the end, relative paths are working just fine, and there's no need to use absolute paths by adding the build working directory.
Thank you for your analysis and your time. I really appreciate it.
hello ππΌ
I am trying to generate code from the OpenTelemetry protobuf definitions.
When configuring a subset of protobuf files to be processed, I encounter a "File not found" error from
protoc
. I guess this is because there is no way to specify the "--proto-path=" option in the protoc command run on generation?That option seems to be needed to resolve imports.
For completeness, my build config is below. I have a submodule in the
proto-src/
directory, and with/without absolute paths, the import in https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/resource/v1/resource.proto#L19 is not resolved.WDYT? Thanks ππΌ