Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tikv-client to brand new rust package won't build #142

Closed
dustbort opened this issue Apr 9, 2020 · 4 comments
Closed

Adding tikv-client to brand new rust package won't build #142

dustbort opened this issue Apr 9, 2020 · 4 comments

Comments

@dustbort
Copy link

dustbort commented Apr 9, 2020

Manjaro Linux, Release 19.0.2
rustc 1.42.0 (b8cedc004 2020-03-09)
cargo 1.42.0 (86334295e 2020-01-31)
cmake version 3.17.0

Steps to reproduce:

  1. Create a new rust lib: cargo new foo --lib.
  2. Add tikv-client under [dependencies] in Cargo.toml: tikv-client = { git = "https://github.com/tikv/client-rust.git" }
  3. Run cargo build.

Build output:

   Compiling libc v0.2.68
   Compiling cfg-if v0.1.10
   Compiling proc-macro2 v1.0.10
   Compiling unicode-xid v0.2.0
   Compiling cc v1.0.50
   Compiling syn v1.0.17
   Compiling memchr v2.3.3
   Compiling autocfg v1.0.0
   Compiling log v0.4.8
   Compiling bytes v0.5.4
   Compiling lazy_static v1.4.0
   Compiling bitflags v1.2.1
   Compiling pkg-config v0.3.17
   Compiling either v1.5.3
   Compiling getrandom v0.1.14
   Compiling anyhow v1.0.28
   Compiling failure_derive v0.1.7
   Compiling ppv-lite86 v0.2.6
   Compiling rustc-demangle v0.1.16
   Compiling proc-macro2 v0.4.30
   Compiling byteorder v1.3.4
   Compiling slab v0.4.2
   Compiling unicode-segmentation v1.6.0
   Compiling remove_dir_all v0.5.2
   Compiling futures-core v0.3.4
   Compiling unicode-xid v0.1.0
   Compiling syn v0.15.44
   Compiling regex-syntax v0.6.17
   Compiling fixedbitset v0.2.0
   Compiling version_check v0.1.5
   Compiling multimap v0.8.1
   Compiling glob v0.3.0
   Compiling futures v0.1.29
   Compiling fnv v1.0.6
   Compiling proc-macro-nested v0.1.4
   Compiling futures-sink v0.3.4
   Compiling proc-macro-hack v0.5.15
   Compiling version_check v0.9.1
   Compiling itoa v0.4.5
   Compiling pin-utils v0.1.0-alpha.4
   Compiling futures-task v0.3.4
   Compiling futures-io v0.3.4
   Compiling pin-project-lite v0.1.4
   Compiling openssl v0.10.29
   Compiling fixedbitset v0.1.9
   Compiling bindgen v0.51.1
   Compiling foreign-types-shared v0.1.1
   Compiling peeking_take_while v0.1.2
   Compiling shlex v0.1.1
   Compiling smallvec v1.3.0
   Compiling httparse v1.3.4
   Compiling multimap v0.4.0
   Compiling native-tls v0.2.4
   Compiling rustc-hash v1.1.0
   Compiling matches v0.1.8
   Compiling same-file v1.0.6
   Compiling crc32fast v1.2.0
   Compiling openssl-probe v0.1.2
   Compiling try-lock v0.2.2
   Compiling protobuf v2.8.0
   Compiling serde v1.0.106
   Compiling percent-encoding v2.1.0
   Compiling tower-service v0.3.0
   Compiling encoding_rs v0.8.22
   Compiling take_mut v0.2.2
   Compiling rle-decode-fast v1.0.1
   Compiling dtoa v0.4.5
   Compiling adler32 v1.0.4
   Compiling mime v0.3.16
   Compiling base64 v0.11.0
   Compiling hex v0.4.2
   Compiling prometheus v0.8.0
   Compiling spin v0.5.2
   Compiling futures-timer v3.0.2
   Compiling cmake v0.1.42
   Compiling thread_local v1.0.1
   Compiling indexmap v1.3.2
   Compiling itertools v0.8.2
   Compiling backtrace-sys v0.1.35
   Compiling openssl-sys v0.9.55
   Compiling libloading v0.5.2
   Compiling libz-sys v1.0.25
   Compiling heck v0.3.1
   Compiling nom v4.2.3
   Compiling clang-sys v0.28.1
   Compiling futures-channel v0.3.4
   Compiling unicase v2.6.0
   Compiling http v0.2.1
   Compiling petgraph v0.4.13
   Compiling foreign-types v0.3.2
   Compiling unicode-normalization v0.1.12
   Compiling unicode-bidi v0.3.4
   Compiling walkdir v2.3.1
   Compiling idna v0.2.0
   Compiling quote v1.0.3
   Compiling iovec v0.1.4
   Compiling which v3.1.1
   Compiling num_cpus v1.12.0
   Compiling net2 v0.2.33
   Compiling time v0.1.42
   Compiling http-body v0.3.1
   Compiling want v0.3.0
   Compiling aho-corasick v0.7.10
   Compiling quote v0.6.13
   Compiling libflate v0.1.27
   Compiling url v2.1.1
   Compiling bytes v0.4.12
   Compiling rand_core v0.5.1
   Compiling prost-build v0.6.1
   Compiling mio v0.6.21
   Compiling petgraph v0.5.0
   Compiling regex v1.3.6
   Compiling backtrace v0.3.46
   Compiling mime_guess v2.0.3
   Compiling cexpr v0.3.6
   Compiling procfs v0.7.8
   Compiling serde_urlencoded v0.6.1
   Compiling rand_chacha v0.2.2
   Compiling tokio v0.2.16
   Compiling synstructure v0.12.3
   Compiling prost-derive v0.6.1
   Compiling derive-new v0.5.8
   Compiling futures-macro v0.3.4
   Compiling pin-project-internal v0.4.8
   Compiling thiserror-impl v1.0.14
   Compiling serde_derive v1.0.106
   Compiling rand v0.7.3
   Compiling tokio-util v0.3.1
   Compiling tokio-tls v0.3.0
   Compiling futures-util v0.3.4
   Compiling prost v0.6.1
   Compiling thiserror v1.0.14
   Compiling tempfile v3.1.0
   Compiling pin-project v0.4.8
   Compiling failure v0.1.7
   Compiling prost-types v0.6.1
   Compiling which v2.0.1
   Compiling prost-derive v0.5.0
   Compiling h2 v0.2.4
   Compiling futures-executor v0.3.4
   Compiling prost-build v0.5.0
   Compiling futures v0.3.4
   Compiling grpcio-compiler v0.5.0
   Compiling hyper v0.13.4
   Compiling prost v0.5.0
   Compiling protobuf-build v0.11.1
   Compiling grpcio-sys v0.5.2
   Compiling prost-types v0.5.0
   Compiling hyper-tls v0.4.1
   Compiling protobuf-build v0.8.0
   Compiling kvproto v0.0.2 (https://github.com/pingcap/kvproto.git#05af14db)
   Compiling reqwest v0.10.4
   Compiling raft-proto v0.6.0-alpha
   Compiling grpcio-sys v0.5.2
   Compiling grpcio v0.5.1
   Compiling kvproto v0.0.2 (https://github.com/pingcap/kvproto.git#05af14db)
error[E0277]: the trait bound `raft_proto::protos::eraftpb::Entry: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/debugpb.rs:22:28
    |
22  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Entry`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:914:12
    |
914 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encode`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:11:28
    |
11  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Entry: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/debugpb.rs:22:28
    |
22  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Entry`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:929:12
    |
929 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::merge`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:11:28
    |
11  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Entry: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/debugpb.rs:22:28
    |
22  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Entry`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:975:12
    |
975 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encoded_len`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:11:28
    |
11  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Entry: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_cmdpb.rs:219:28
    |
219 | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Entry`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:914:12
    |
914 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encode`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:11:28
    |
11  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Entry: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_cmdpb.rs:219:28
    |
219 | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Entry`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:962:12
    |
962 |         M: Message + Default,
    |            ------- required by this bound in `prost::encoding::message::merge_repeated`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:11:28
    |
11  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Entry: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_cmdpb.rs:219:28
    |
219 | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Entry`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:984:12
    |
984 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encoded_len_repeated`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:11:28
    |
11  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Message: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_serverpb.rs:1:28
    |
1   | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Message`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:914:12
    |
914 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encode`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:48:28
    |
48  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Message: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_serverpb.rs:1:28
    |
1   | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Message`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:929:12
    |
929 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::merge`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:48:28
    |
48  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::Message: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_serverpb.rs:1:28
    |
1   | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::Message`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:975:12
    |
975 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encoded_len`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:48:28
    |
48  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::HardState: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_serverpb.rs:85:28
    |
85  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::HardState`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:914:12
    |
914 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encode`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:77:28
    |
77  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::HardState: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_serverpb.rs:85:28
    |
85  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::HardState`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:929:12
    |
929 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::merge`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:77:28
    |
77  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error[E0277]: the trait bound `raft_proto::protos::eraftpb::HardState: prost::message::Message` is not satisfied
   --> /home/dustin/code/repos/foo/target/debug/build/kvproto-c6c7a7e0753b46b4/out/protos/raft_serverpb.rs:85:28
    |
85  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `raft_proto::protos::eraftpb::HardState`
    | 
   ::: /home/dustin/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-0.6.1/src/encoding.rs:975:12
    |
975 |         M: Message,
    |            ------- required by this bound in `prost::encoding::message::encoded_len`
    |
help: trait impl with same name found
   --> /home/dustin/code/repos/foo/target/debug/build/raft-proto-277624fcfd4979d6/out/protos/eraftpb.rs:77:28
    |
77  | #[derive(Clone, PartialEq, ::prost::Message)]
    |                            ^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `prost` are being used?

error: aborting due to 12 previous errors

For more information about this error, try `rustc --explain E0277`.
error: could not compile `kvproto`.

I see that #32 is open, but it doesn't mention kvproto not building.

@TommyCpp
Copy link

I ran into the same problem and was able to resolve it by add the following to Cargo.toml file.

[patch.crates-io]
raft-proto = { git = "https://github.com/tikv/raft-rs", rev = "e624c1d48460940a40d8aa69b5329460d9af87dd" }

@ProgramSalamander
Copy link

ProgramSalamander commented Oct 11, 2020

I also met this problem and I'm new to rust. I'm wondering what is causing this problem, and would there be any offcial solution.

Applied the solution by @TommyCpp, got another error:

error[E0063]: missing field `sender_id` in initializer of `kvproto::pdpb::RequestHeader`
   --> /Users/xuyangchen/.cargo/git/checkouts/client-rust-5a1ccd35a54db20f/ad8ef07/tikv-client-pd/src/timestamp.rs:153:30
    |
153 |                 header: Some(RequestHeader {
    |                              ^^^^^^^^^^^^^ missing `sender_id`

error[E0063]: missing field `dc_location` in initializer of `kvproto::pdpb::TsoRequest`
   --> /Users/xuyangchen/.cargo/git/checkouts/client-rust-5a1ccd35a54db20f/ad8ef07/tikv-client-pd/src/timestamp.rs:152:23
    |
152 |             let req = TsoRequest {
    |                       ^^^^^^^^^^ missing `dc_location`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0063`.
error: could not compile `tikv-client-pd`.

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

@mckingho
Copy link

@ProgramSalamander There is an update adding these fields in kvproto. But the this repo's lock file is still using an older version c0e3a4d8bbece2b8d796ed5a08649ea5223b7abf.

I have tried to add kvproto = { git = "https://github.com/pingcap/kvproto.git", rev = "c0e3a4d8bbece2b8d796ed5a08649ea5223b7abf" } in my project's Crate.toml file, either under [dependencies] or [patch.crates-io]. But both do not work.

A temporary workaround is used now. I modify Cargo.lock and change kvproto's version hash to c0e3a4d8bbece2b8d796ed5a08649ea5223b7abf.

Anyone can tell me how to modify Crate.toml so that I can download specific version's crate instead of latest commits?

@ekexium
Copy link
Collaborator

ekexium commented Nov 2, 2020

@mckingho @ProgramSalamander Fixed by #192. We do not depend on kvproto now.

@nrc nrc closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants