stepancheg / grpc-rust

Rust implementation of gRPC
MIT License
1.38k stars 125 forks source link

build error #192

Closed shangsony closed 3 years ago

shangsony commented 3 years ago
warning: use of deprecated item 'protobuf::message::parse_from_bytes': Use Message::parse_from_bytes instead --> protoc-rust-grpc/src/lib.rs:139:60 139 let fds: protobuf::descriptor::FileDescriptorSet = protobuf::parse_from_bytes(&fds) ^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: `#[warn(deprecated)]` on by default

warning: 1 warning emitted

Compiling grpc_examples_greeter v0.0.0 (/mnt/d/work/geely/rust_test/grpc-rust/grpc-examples/greeter) Compiling long_tests v0.0.0 (/mnt/d/work/geely/rust_test/grpc-rust/long-tests/with-rust) Compiling grpc-interop v0.0.0 (/mnt/d/work/geely/rust_test/grpc-rust/interop) Compiling grpc_examples_route_guide v0.0.0 (/mnt/d/work/geely/rust_test/grpc-rust/grpc-examples/route_guide) Compiling futures-executor v0.3.12 Compiling futures v0.3.12 Compiling grpc v0.8.2 (/mnt/d/work/geely/rust_test/grpc-rust/grpc) warning: field is never read: conf --> grpc/src/server/mod.rs:81:5 81 conf: ServerConf, ^^^^^^^^^^^^^^^^

= note: #[warn(dead_code)] on by default

warning: field is never read: sender --> grpc/src/req.rs:77:5 | 77 | sender: Option<mpsc::Sender>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Compiling grpc-protobuf v0.8.2 (/mnt/d/work/geely/rust_test/grpc-rust/grpc-protobuf) warning: 2 warnings emitted

error[E0308]: mismatched types --> grpc-protobuf/src/lib.rs:27:62 27 let mut is = CodedInputStream::from_carllerche_bytes(&buf); ^^^^ expected struct bytes::bytes::Bytes, found a different struct bytes::bytes::Bytes

= note: expected reference &bytes::bytes::Bytes (struct bytes::bytes::Bytes) found reference &bytes::bytes::Bytes (struct bytes::bytes::Bytes) = note: perhaps two different versions of crate bytes are being used?

error: aborting due to previous error

For more information about this error, try rustc --explain E0308. error: could not compile grpc-protobuf.

To learn more, run the command again with --verbose. warning: build failed, waiting for other jobs to finish... error: build failed

stepancheg commented 3 years ago

I'm working on upgrade.

For now dependency version should be explicitly restricted to older version.

jt-nti commented 3 years ago

I'm attempting to restrict the dependencies to an older version using this...

protobuf = "=2.17.0"
protoc-rust = "=2.17.0"

Which seemed to resolve the build error above, however I then get errors like this...

error[E0599]: no function or associated item named `parse_from_bytes` found for trait object `(dyn protobuf::Message + 'static)` in the current scope
   --> src/transientstore.rs:308:26
    |
308 |     ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
    |                          ^^^^^^^^^^^^^^^^
    |                          |
    |                          function or associated item not found in `(dyn protobuf::Message + 'static)`
    |                          help: there is an associated function with a similar name: `merge_from_bytes`

error: aborting due to 40 previous errors

Guessing wildly, I wondered if that's due to the generated files now being out of step...

// This file is generated by rust-protobuf 2.20.0. Do not edit

I tried cargo install grpc-compiler --version 0.8.2 --locked which looked like it picked up a matching version of protobuf

    Updating crates.io index
  Installing grpc-compiler v0.8.2
   Compiling protobuf v2.17.0
   Compiling protobuf-codegen v2.17.0
   Compiling grpc-compiler v0.8.2

Unfortunately the generated files looked the same. Any tips for what else I could try appreciated, otherwise I'll wait for the upgrade. Thanks.

stepancheg commented 3 years ago

Updated version to 0.8.3 which should fix the compilation.

Protobuf version is pinned to 2.18.2 to fix incompatibility with bytes crate.

Update to grpc to latest protobuf and other crates is WIP.

Please reopen if the issue persists.

jt-nti commented 3 years ago

Hi @stepancheg, I'm still having trouble getting things to work when generating code with protoc but I'm not sure whether it's really this issue, or something else I'm doing wrong- still seeing // This file is generated by rust-protobuf 2.20.0. Do not edit in the generated files which looks suspicious. Just a side project but if you think it's worth opening a new issue somewhere, or reopening this one, please let me know. Thanks.