fdeantoni / prost-wkt

Prost Well-Known-Types serialization and deserialization.
Apache License 2.0
75 stars 33 forks source link

protoc fails to find google/protobuf/duration.proto when building types #66

Closed saman3d closed 3 months ago

saman3d commented 3 months ago

when running cargo check in wkt-types this error occurs:

error: failed to run custom build command for `prost-wkt-types v0.5.1 (/home/saman/rust/prost-wkt/wkt-types)`

Caused by:
  process didn't exit successfully: `/home/saman/rust/prost-wkt/target/debug/build/prost-wkt-types-4c7c9648485987ac/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at wkt-types/build.rs:47:10:
  called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: google/protobuf/duration.proto: File not found.\ngoogle/protobuf/timestamp.proto: File not found.\npbtime.proto:3:1: Import \"google/protobuf/duration.proto\" was not found or had errors.\npbtime.proto:4:1: Import \"google/protobuf/timestamp.proto\" was not found or had errors.\n" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

protoc can't find google protobuf includes although i have them in /usr/local/include

saman3d commented 3 months ago

there was a problem with my protoc executable. in order for protoc to find includes it must be present in it's parent directory. for example: if protoc is in: /usr/local/bin/protoc includes directory must be in: /usr/local/includes

fdeantoni commented 3 months ago

Good to hear you found the solution @saman3d! I will check if I can add this tip to the readme so if it happens to someone else they will know what to do.

alexshtin commented 1 month ago

Had same issue and had to copy proto includes. Thanks @saman3d. One correction though:

includes directory must be in: /usr/local/includes

to

includes directory must be in: /usr/local/include