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

Cargo install fails with trait bound not satisfied error in the netlink-request crate #246

Closed
LeMoonStar opened this issue Feb 1, 2023 · 2 comments

Comments

@LeMoonStar
Copy link

Description

Executing cargo install --git https://github.com/tonarino/innernet --tag v1.5.5 client or cargo install --git https://github.com/tonarino/innernet --tag v1.5.5 server as described in the README results in code errors in the netlink-request crate.
I've tested this on both an older Ubuntu Server 18.04 LTS and a freshly installed Ubuntu Server 22.04 LTS system, both running the latest stable rustc. The error is identical with both commands ([...] server and [...] client) and does not get fixed by trying an earlier patch version (1.5.4 and 1.5.0 tested)

Output

client in this case, but the error is identical to the server installation.

$ cargo install --git https://github.com/tonarino/innernet --tag v1.5.5 client
    Updating git repository `https://github.com/tonarino/innernet`
  Installing client v1.5.5 (https://github.com/tonarino/innernet?tag=v1.5.5#eac6071d)
    Updating crates.io index
   Compiling proc-macro2 v1.0.50
   Compiling unicode-ident v1.0.6
   Compiling quote v1.0.23
   Compiling syn v1.0.107
   Compiling libc v0.2.139
   Compiling paste v1.0.11
   Compiling thiserror v1.0.38
   Compiling anyhow v1.0.68
   Compiling version_check v0.9.4
   Compiling log v0.4.17
   Compiling byteorder v1.4.3
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.152
   Compiling proc-macro-error-attr v1.0.4
   Compiling platforms v3.0.2
   Compiling serde v1.0.152
   Compiling proc-macro-error v1.0.4
   Compiling autocfg v1.1.0
   Compiling bitflags v1.3.2
   Compiling tinyvec_macros v0.1.0
   Compiling tinyvec v1.6.0
   Compiling indexmap v1.9.2
   Compiling memchr v2.5.0
   Compiling curve25519-dalek v4.0.0-rc.0
   Compiling unicode-normalization v0.1.22
   Compiling atty v0.2.14
   Compiling hashbrown v0.12.3
   Compiling bytes v1.4.0
   Compiling unicode-bidi v0.3.10
   Compiling heck v0.4.1
   Compiling lazy_static v1.4.0
   Compiling percent-encoding v2.2.0
   Compiling once_cell v1.17.0
   Compiling os_str_bytes v6.4.1
   Compiling form_urlencoded v1.1.0
   Compiling clap_lex v0.2.4
   Compiling idna v0.3.0
   Compiling netlink-sys v0.8.4
   Compiling thiserror-impl v1.0.38
   Compiling clap_derive v3.2.18
   Compiling unicode-width v0.1.10
   Compiling strsim v0.10.0
   Compiling zeroize v1.5.7
   Compiling serde_json v1.0.91
   Compiling textwrap v0.16.0
   Compiling netlink-packet-utils v0.5.2
   Compiling netlink-packet-core v0.5.0
   Compiling netlink-packet-generic v0.3.2
   Compiling netlink-packet-core v0.4.2
   Compiling netlink-packet-route v0.13.0
   Compiling base64 v0.13.1
   Compiling termcolor v1.2.0
   Compiling subtle v2.4.1
   Compiling clap v3.2.23
   Compiling netlink-request v1.5.5 (/home/username/.cargo/git/checkouts/innernet-e473261454a9fbf4/eac6071/netlink-request)
error[E0277]: the trait bound `GenlMessage<GenlCtrl>: NetlinkSerializable` is not satisfied
  --> netlink-request/src/lib.rs:43:50
   |
43 |                 netlink_request_genl::<GenlCtrl>(genlmsg, Some(NLM_F_REQUEST | NLM_F_ACK))?;
   |                 -------------------------------- ^^^^^^^ the trait `NetlinkSerializable` is not implemented for `GenlMessage<GenlCtrl>`
   |                 |
   |                 required by a bound introduced by this call
   |
   = help: the trait `NetlinkSerializable` is implemented for `RtnlMessage`
note: required by a bound in `netlink_request_genl`
  --> netlink-request/src/lib.rs:35:46
   |
29 |     pub fn netlink_request_genl<F>(
   |            -------------------- required by a bound in this
...
35 |         GenlMessage<F>: Clone + Debug + Eq + NetlinkSerializable + NetlinkDeserializable,
   |                                              ^^^^^^^^^^^^^^^^^^^ required by this bound in `netlink_request_genl`

error[E0277]: the trait bound `GenlMessage<GenlCtrl>: NetlinkDeserializable` is not satisfied
  --> netlink-request/src/lib.rs:43:50
   |
43 |                 netlink_request_genl::<GenlCtrl>(genlmsg, Some(NLM_F_REQUEST | NLM_F_ACK))?;
   |                 -------------------------------- ^^^^^^^ the trait `NetlinkDeserializable` is not implemented for `GenlMessage<GenlCtrl>`
   |                 |
   |                 required by a bound introduced by this call
   |
   = help: the trait `NetlinkDeserializable` is implemented for `RtnlMessage`
note: required by a bound in `netlink_request_genl`
  --> netlink-request/src/lib.rs:35:68
   |
29 |     pub fn netlink_request_genl<F>(
   |            -------------------- required by a bound in this
...
35 |         GenlMessage<F>: Clone + Debug + Eq + NetlinkSerializable + NetlinkDeserializable,
   |                                                                    ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `netlink_request_genl`

error[E0308]: mismatched types
  --> netlink-request/src/lib.rs:66:25
   |
66 |         netlink_request(message, flags, NETLINK_GENERIC)
   |         --------------- ^^^^^^^ expected enum `RtnlMessage`, found struct `GenlMessage`
   |         |
   |         arguments to this function are incorrect
   |
   = note: expected enum `RtnlMessage`
            found struct `GenlMessage<F>`
note: function defined here
  --> netlink-request/src/lib.rs:76:12
   |
76 |     pub fn netlink_request<I>(
   |            ^^^^^^^^^^^^^^^
77 |         message: I,
   |         ----------

error[E0308]: mismatched types
  --> netlink-request/src/lib.rs:66:9
   |
32 |     ) -> Result<Vec<NetlinkMessage<GenlMessage<F>>>, io::Error>
   |          ------------------------------------------------------ expected `Result<Vec<NetlinkMessage<GenlMessage<F>>>, std::io::Error>` because of return type
...
66 |         netlink_request(message, flags, NETLINK_GENERIC)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `GenlMessage`, found enum `RtnlMessage`
   |
   = note: expected enum `Result<Vec<NetlinkMessage<GenlMessage<F>>>, _>`
              found enum `Result<Vec<NetlinkMessage<RtnlMessage>>, _>`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `netlink-request` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `client v1.5.5 (https://github.com/tonarino/innernet?tag=v1.5.5#eac6071d)`, intermediate artifacts can be found at `/tmp/cargo-installw4kyoZ`
@LeMoonStar LeMoonStar changed the title Cargo install fails with code error in the netlink-request crate Cargo install fails with trait bound not satisfied error in the netlink-request crate Feb 1, 2023
@strohel
Copy link
Member

strohel commented Feb 2, 2023

Hi @LeMoonStar, I can indeed reproduce the same problem.

A quick work-around is to append --locked to the cargo build command: cargo install --git https://github.com/tonarino/innernet --tag v1.5.5 client --locked (it fixes the build for me)

The likely explanation is that some of our dependencies was updated in non-semver-compatible way (they changed API without bumping the version appropriately). I'll look into that.

@strohel strohel self-assigned this Feb 2, 2023
@strohel strohel removed their assignment Apr 24, 2023
@strohel
Copy link
Member

strohel commented Mar 13, 2024

Hi @LeMoonStar, I think we've fixed this in #281, can you please try with latest innernet? Optimistically closing this issue already.

@strohel strohel closed this as completed Mar 13, 2024
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

2 participants