tikv / grpc-rs

The gRPC library for Rust built on C Core library and futures
Apache License 2.0
1.81k stars 253 forks source link

`grpcio-proto` 0.7 and 0.8 now fail to build as a dependency #528

Closed Spferical closed 3 years ago

Spferical commented 3 years ago

Describe the bug grpcio-proto 0.8 brings in protobuf-build. protobuf-build versions 12.1+ depend on grpcio-compiler>=0.8.0, which as of today brings in grpcio-compiler 0.9.0, which causes the build to fail when building grpc-proto 0.8 as a dependency.

grpcio-proto 0.7 (and maybe older versions) has the same issue, because protobuf-build 0.11.4 brings in grpcio-compiler>=0.5.0.

This can be worked around with cargo patches, but it is a bit painful to do so.

To Reproduce Steps to reproduce the behavior:

  1. Make a new crate and add grpcio-proto = "0.8" to the dependencies array in its Cargo.toml.
  2. cargo check
    Checking grpcio-proto v0.8.1
error[E0433]: failed to resolve: could not find `unimplemented_call` in `grpcio`
   --> /home/matthew/misc/grpc-test/target/debug/build/grpcio-proto-ca27f1d4f4011d16/out/testing/test_grpc.rs:189:17
    |
189 |         grpcio::unimplemented_call!(ctx, sink)
    |                 ^^^^^^^^^^^^^^^^^^ could not find `unimplemented_call` in `grpcio`
<many copies of the same error...>

Expected behavior Old versions of grpcio-protobuf should continue to build as dependencies without cargo-patching inner dependencies when a new version is released. Unfortunately, I think this can only be done by yanking grpcio-compiler 0.9.0 and/or releasing a version of it that works with old grpcio-proto versions.

Alternatively, new patch releases of protobuf-build and/or old versions of grpcio-proto to fix the issue might help, but I haven't fully thought through how that would need to work -- I understand there's a cyclic dependency the >= dependency fixes (at the cost of breaking old versions' builds).

System information

Additional context

BusyJay commented 3 years ago

I have been thinking about dropping the dependency on protobuf-build to fix cyclic dependency permanently, though it may break a lot of things and be a pain for dependent of grpcio-proto to compile with protobuf-codec and prost-codec with same sources.

To work around the problem for now, I can patch the macros to 0.8.0.

Spferical commented 3 years ago

Thank you! Could you please cherry-pick the patch to 0.7.x as well?

BusyJay commented 3 years ago

Now 0.7.2 and 0.8.3 are published to work with new compiler.