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 hyperfine' fails on Windows #624

Closed
rbtcollins opened this issue Mar 11, 2023 · 9 comments · Fixed by #636
Closed

'cargo install hyperfine' fails on Windows #624

rbtcollins opened this issue Mar 11, 2023 · 9 comments · Fixed by #636

Comments

@rbtcollins
Copy link

error[E0432]: unresolved import `winapi::um::handleapi`
 --> ....cargo\registry\src\github.com-1ecc6299db9ec823\hyperfine-1.15.0\src\timer\windows_timer.rs:9:9
  |
9 |         handleapi::CloseHandle,
  |         ^^^^^^^^^ could not find `handleapi` in `um`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `hyperfine` due to previous error
error: failed to compile `hyperfine v1.15.0`, intermediate artifacts can be found at `...AppData\Local\Temp\cargo-installRqHcG9`
@rbtcollins
Copy link
Author

cargo install --locked hyperfine

Succeeds, so I presume its a incompat in a semver-compatible change to winapi.

@sharkdp
Copy link
Owner

sharkdp commented Mar 12, 2023

See #595. This should be fixed on master? (#596)

@sharkdp sharkdp closed this as completed Mar 12, 2023
@Halkcyon
Copy link

Halkcyon commented Apr 12, 2023

@sharkdp I am still getting these build failures as of 1.16.1 on win11 / rust 1.68.2. Do you want me to open a new issue? install --locked got me through.

error[E0308]: mismatched types
   --> C:\Users\maximilian\.cargo\registry\src\github.com-1ecc6299db9ec823\hyperfine-1.16.1\src\timer\windows_timer.rs:56:65
    |
56  | ... { AssignProcessToJobObject(job_object, child.as_raw_handle()) };
    |       ------------------------             ^^^^^^^^^^^^^^^^^^^^^ expected enum `winapi::ctypes::c_void`, found enum `std::ffi::c_void`
    |       |
    |       arguments to this function are incorrect
    |
    = note: enum `std::ffi::c_void` and enum `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: enum `std::ffi::c_void` is defined in crate `core`
   --> C:\Users\maximilian\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\mod.rs:203:1
    |
203 | pub enum c_void {
    | ^^^^^^^^^^^^^^^
note: enum `winapi::ctypes::c_void` is defined in crate `winapi`
   --> C:\Users\maximilian\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.3.9\src\lib.rs:38:5
    |
38  |     pub enum c_void {}
    |     ^^^^^^^^^^^^^^^
note: function defined here
   --> C:\Users\maximilian\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.3.9\src\um\jobapi2.rs:32:12
    |
32  |     pub fn AssignProcessToJobObject(
    |            ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> C:\Users\maximilian\.cargo\registry\src\github.com-1ecc6299db9ec823\hyperfine-1.16.1\src\timer\windows_timer.rs:73:48
    |
73  |             let ret = unsafe { NtResumeProcess(child.as_raw_handle()) };
    |                                --------------- ^^^^^^^^^^^^^^^^^^^^^ expected enum `winapi::ctypes::c_void`, found enum `std::ffi::c_void`
    |                                |
    |                                arguments to this function are incorrect
    |
    = note: enum `std::ffi::c_void` and enum `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: enum `std::ffi::c_void` is defined in crate `core`
   --> C:\Users\maximilian\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\mod.rs:203:1
    |
203 | pub enum c_void {
    | ^^^^^^^^^^^^^^^
note: enum `winapi::ctypes::c_void` is defined in crate `winapi`
   --> C:\Users\maximilian\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.3.9\src\lib.rs:38:5
    |
38  |     pub enum c_void {}
    |     ^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `hyperfine` due to 2 previous errors
error: failed to compile `hyperfine v1.16.1`, intermediate artifacts can be found at `C:\Users\MAXIMI~1\AppData\Local\Temp\cargo-installvG1EFr`

@sharkdp
Copy link
Owner

sharkdp commented Apr 14, 2023

Thank you for reporting this. It's another issue, but we can just reopen this one.

Maybe @clemenswasser has an idea what's going on here?

@clemenswasser
Copy link
Contributor

@sharkdp I've opened a PR.
But now that tempfile, console, terminal_size and is-terminal depend on it, it might make sense to switch to the official windows-sys crate. This would remove the headaches and uncertainty (in terms of maintenance status) caused by winapi?

@sharkdp
Copy link
Owner

sharkdp commented Apr 17, 2023

Thank you. I have merged your PR as a fix. I still don't fully understand how this happened? winapi didn't release a new version in years... and std::process::Child::as_raw_handle() certainly didn't change it's return type?

But now that tempfile, console, terminal_size and is-terminal depend on it, it might make sense to switch to the official windows-sys crate. This would remove the headaches and uncertainty (in terms of maintenance status) caused by winapi?

That'd be great! I opened a ticket here: #639

@sharkdp
Copy link
Owner

sharkdp commented Apr 20, 2023

@Halkcyon this should now be fixed on master

@osiewicz
Copy link

osiewicz commented May 9, 2023

I've also ran into this issue in rust-lang/miri#2877 (comment) . master works just fine, though I'd prefer to use official release if possible.
When will the next version of hyperfine be released?

@sharkdp
Copy link
Owner

sharkdp commented Jun 3, 2023

Today: https://github.com/sharkdp/hyperfine/releases/tag/v1.17.0

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

Successfully merging a pull request may close this issue.

5 participants