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

tokio v1.18.1 not compiling on Windows 10 #4662

Closed
Sid-Shanker opened this issue May 8, 2022 · 4 comments · Fixed by #4663
Closed

tokio v1.18.1 not compiling on Windows 10 #4662

Sid-Shanker opened this issue May 8, 2022 · 4 comments · Fixed by #4663
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug.

Comments

@Sid-Shanker
Copy link

Version
1.18.1

Platform
Windows 64-bit

Description
I was trying to follow actix web development tutorial on its official page : https://actix.rs/docs/getting-started/. Current actix-web version is 4, which uses rust version 1.54 or later. I had rust version 1.46 already installed, so as per instruction on this page i updated it using rustup update and now current version of rust on my system is 1.60.
When I try to build the project, then it gives me compilation error like this:

Downloaded 113 crates (14.9 MB) in 13.43s (largest was `windows-sys` at 3.3 MB)
   Compiling tokio v1.18.1
error[E0432]: unresolved import `crate::winapi::um::fileapi`
  --> C:\Users\Shanker\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.1\src\net\windows\named_pipe.rs:24:20
   |
24 |     pub(super) use crate::winapi::um::fileapi;
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `fileapi` in `um`

error[E0432]: unresolved import `crate::winapi::um::handleapi`
  --> C:\Users\Shanker\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.1\src\net\windows\named_pipe.rs:25:20
   |
25 |     pub(super) use crate::winapi::um::handleapi;
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `handleapi` in `um`

error[E0432]: unresolved import `crate::winapi::um::winbase`
  --> C:\Users\Shanker\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.1\src\net\windows\named_pipe.rs:27:20
   |
27 |     pub(super) use crate::winapi::um::winbase;
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `winbase` in `um`

error[E0308]: mismatched types
    --> C:\Users\Shanker\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.1\src\net\windows\named_pipe.rs:2125:42
     |
2125 |         NamedPipeServer::from_raw_handle(h)
     |                                          ^ expected enum `std::ffi::c_void`, found enum `winapi::ctypes::c_void`
     |
     = note: expected raw pointer `*mut std::ffi::c_void`
                found raw pointer `*mut winapi::ctypes::c_void`

error[E0308]: mismatched types
    --> C:\Users\Shanker\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.1\src\net\windows\named_pipe.rs:2385:9
     |
2385 |         handle,
     |         ^^^^^^ expected enum `winapi::ctypes::c_void`, found enum `std::ffi::c_void`
     |
     = note: expected raw pointer `*mut winapi::ctypes::c_void`
                found raw pointer `*mut std::ffi::c_void`

Some errors have detailed explanations: E0308, E0432.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `tokio` due to 5 previous errors

After some searching about it, i found one suggestion that it could be due to cached crates, so i did cargo clean and then also I manually removed the whole registry folder in C:\Users\myuser\.cargo\registry but still when building the project, its gives me same error.

@Sid-Shanker Sid-Shanker added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels May 8, 2022
@jonhoo
Copy link
Sponsor Contributor

jonhoo commented May 8, 2022

I see this in CI as well.

@Darksonn
Copy link
Contributor

Darksonn commented May 8, 2022

This is due to mio switching from winapi to windows-sys. In the mean time, you can fix it by adding the following dependency.

winapi = { version = "0.3.9", features = ["std", "winsock2", "mswsock", "handleapi", "ws2ipdef", "ws2tcpip"] }

or by downgrading to mio version 0.8.2.

@Sid-Shanker
Copy link
Author

This is due to mio switching from winapi to windows-sys. In the mean time, you can fix it by adding the following dependency.

winapi = { version = "0.3.9", features = ["std", "winsock2", "mswsock", "handleapi", "ws2ipdef", "ws2tcpip"] }

or by downgrading to mio version 0.8.2.

It worked after adding this dependency. Thanks

@Darksonn Darksonn reopened this May 8, 2022
@Darksonn
Copy link
Contributor

Darksonn commented May 8, 2022

This will be released shortly in #4666.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants