Closed mskrzypkows closed 2 years ago
I am also getting this error, had to downgrade it to v0.14.20 since my project would not build with v0.14.21
hyper = { version = "=0.14.20", features = ["full"] }
Looks like it needs a more complex blob of cfgs:
#[cfg(all(
feature = "all",
any(
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "illumos",
target_os = "linux",
target_os = "netbsd",
target_vendor = "apple",
windows,
)
))]
PR to fix this, if any wants to confirm it works on their platform: https://github.com/hyperium/hyper/pull/3039
Published v0.14.22 with the fix.
I am still getting this error with v0.14.22 on Windows 10 Server
--> C:\Users\Admin\.cargo\registry\src\github.com-1ecc6299db9ec823\hyper-0.14.22\src\server\tcp.rs:59:12
|
59 | ka.with_interval(interval)
| ^^^^^^^^^^^^^ method not found in 'TcpKeepalive'
Also still seeing the issue on macOS with 0.14.22:
Compiling hyper v0.14.22
error[E0599]: no method named `with_interval` found for struct `TcpKeepalive` in the current scope
--> /Users/chris/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.22/src/server/tcp.rs:59:12
|
59 | ka.with_interval(interval)
| ^^^^^^^^^^^^^ method not found in `TcpKeepalive`
error[E0599]: no method named `with_retries` found for struct `TcpKeepalive` in the current scope
--> /Users/chris/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.22/src/server/tcp.rs:89:12
|
89 | ka.with_retries(retries)
| ^^^^^^^^^^^^ help: there is an associated function with a similar name: `with_time`
Can you check what version of socket2
is listed in your Cargo.lock
? Maybe we need to force a newer one?
It was 0.4.1 for me. Adding this to my Cargo.toml does seem to resolve the issue:
socket2 = { version = "0.4.7", features = ["all"] }
Ok, so for most people that run into this, I imagine this should fix you: cargo update -p socket2
.
It doesn't. The version isn't the problem. Hyper is trying to use APIs that are only available when the "all" feature of socket2 is enabled.
This also fixes the issue:
socket2 = { version = "=0.4.1", features = ["all"] }
However, just updating to the latest socket2 does not help:
socket2 = "=0.4.7"
It appears to me that Hyper should have a features = ["all"]
added to its socket2
dependency.
Ah, interesting. I saw Tokio's Cargo.toml
already sets that feature. (Doesn't mean hyper shouldn't). I suspect maybe just newer versions of Tokio have it set.
I got the same error and I didn't depend directly on hyper. I got error when I was running cargo clippy --tests --workspace
cargo clippy --tests --workspace
Checking hyper v0.14.22
error[E0599]: no method named `with_interval` found for struct `TcpKeepalive` in the current scope
--> /home/sr/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.22/src/server/tcp.rs:59:12
|
59 | ka.with_interval(interval)
| ^^^^^^^^^^^^^ method not found in `TcpKeepalive`
error[E0599]: no method named `with_retries` found for struct `TcpKeepalive` in the current scope
--> /home/sr/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.22/src/server/tcp.rs:89:12
|
89 | ka.with_retries(retries)
| ^^^^^^^^^^^^ help: there is a method with a similar name: `with_time`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `hyper` due to 2 previous errors
adding to Cargo.toml get rid of the error
socket2 = { version = "0.4", features = ["all"] }
v0.14.22 fails for us (dropshot) with a similar error. Is the problem what @ccbrown said, that hyper is missing a dependency on a socket2 feature?
It looks like starting with Tokio v1.17, the features = ["all"]
was added to its socket2
dependency. Are folks experiencing this issue even with Tokio newer than that?
I'll make sure the next 0.14.x release includes it explicitly.
@seanmonstar true I am using tokio with "~1.14.1" that is forced by dependency that I use.
Version v0.14.21
Platform MacOS and Linux
Description
Cannot build the newest hyper: