rojo-rbx / rojo

Rojo enables Roblox developers to use professional-grade software engineering tools
https://rojo.space
Mozilla Public License 2.0
906 stars 170 forks source link

Error with cargo install on windows machine #918

Closed LEEROY-4 closed 1 week ago

LEEROY-4 commented 1 month ago

Can't install rojo with cargo command.

Command: cargo install rojo --version ^7 OS: Windows 10 Home 19045.4412 Cargo: cargo 1.78.0 (54d8815d0 2024-03-26) Rustc: rustc 1.78.0 (9b00956e5 2024-04-29)

Error code:

Compiling want v0.3.1
error[E0308]: mismatched types
   --> C:\Users\User\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-4.0.17\src\windows.rs:276:29
    |
276 |         overlapped.hEvent = request_p;
    |         -----------------   ^^^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
    |         |
    |         expected due to the type of this binding
    |
    = note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
   --> C:\Users\User\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\mod.rs:183:1
    |
183 | pub enum c_void {
    | ^^^^^^^^^^^^^^^
note: `winapi::ctypes::c_void` is defined in crate `winapi`
   --> C:\Users\User\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
    |
38  |     pub enum c_void {}
    |     ^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> C:\Users\User\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-4.0.17\src\windows.rs:282:13
     |
280  |         let ret = winbase::ReadDirectoryChangesW(
     |                   ------------------------------ arguments to this function are incorrect
281  |             handle,
     |             ^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
     = note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
    --> C:\Users\User\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\mod.rs:183:1
     |
183  | pub enum c_void {
     | ^^^^^^^^^^^^^^^
note: `winapi::ctypes::c_void` is defined in crate `winapi`
    --> C:\Users\User\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
     |
38   |     pub enum c_void {}
     |     ^^^^^^^^^^^^^^^
note: function defined here
    --> C:\Users\User\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\um\winbase.rs:2072:12
     |
2072 |     pub fn ReadDirectoryChangesW(
     |            ^^^^^^^^^^^^^^^^^^^^^

   Compiling mio v0.8.11
Dekkonot commented 1 month ago

This is an issue we need to address but it isn't our fault; one of the dependencies downstream broke semver, which has caused compilation issues for multiple crates. A prime example is cargo-watch.

Temporary fix for now is to use --locked when running cargo install, but I will look into what happened and how we can handle it.

Dekkonot commented 1 month ago

This was a fun adventure. It turns out that Notify, our file watcher, wasn't enabling some cargo features it needed to. This meant that when a dependency, winapi-util, updated, it resulted in a build that would normally succeed starting to fail.

The solution is for notify v4 to enable std and winerror as cargo features. I've opened an issue here. If it gets closed without being fixed (let's be frank, Notify v4 is very out of date at this point) then we'll have to upgrade our file watcher.

Going to leave this issue open until the one on Notify gets closed one way or another.

Dekkonot commented 1 week ago

This should be resolved since Notify has made a new patch. Let me know if it's still a problem!