Tonic include problem

I have grpc server that complied and run ok until I updated tonic to the latest version. Now it fails to build

   Compiling tonic v0.9.1
error: couldn't read /Users/bihaber/crypto_service/target/debug/build/crypto_service-f8fe7ed5e86191b1/out/ No such file or directory (os error 2)
 --> src/
3 |     tonic::include_proto!("crypto");
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: this error originates in the macro `include` which comes from the expansion of the macro `tonic::include_proto` (in Nightly builds, run with -Z macro-backtrace for more info)

How can I figure out what is going on in he macro? where is -Z defined?

Try the docs. Probably the issue is the one in the Note.

The note about -Z is talking about a rustc flag that you could use on nightly (e.g. RUSTFLAGS='-Z macro-backtrace' cargo build ...) to give more detailed, macro-related diagnostics. It can be useful when the macro is generating wonky code. Based on the error, I don't think anything like that is going on in this case; it's just looking for a file that doesn't exist.

1 Like

the file is in target. doesn't rebuilding the.project refresh files there.

Piling on. I've run into the same thing with the latest version 0.9.2 in an Alpine docker image on an M1 Mac host.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.