ogham / exa

A modern replacement for ‘ls’.
https://the.exa.website/
MIT License
23.51k stars 660 forks source link

Upgrade to Rust 2021 edition breaks compilation on Windows #1167

Closed fnuttens closed 1 year ago

fnuttens commented 1 year ago

Hi! It seems like this upgrade broke compilation on Windows. rustc tries to compile the users lib even though it is marked as unix specific in Cargo.toml...

debug_assertions
panic="unwind"
target_arch="x86_64"
target_endian="little"
target_env="msvc"
target_family="windows"
target_feature="fxsr"
target_feature="sse"
target_feature="sse2"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_os="windows"
target_pointer_width="64"
target_vendor="pc"
windows

If you are seeing compilation errors, please include the output of the build process.

   Compiling users v0.11.0
   Compiling unicode-normalization v0.1.22
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\fnuttens\.cargo\registry\src\github.com-1ecc6299db9ec823\users-0.11.0\src\base.rs:36:14
   |
36 | use std::os::unix::ffi::OsStrExt;
   |              ^^^^ could not find `unix` in `os`
...

rilysh commented 1 year ago

It seems like users crate needs to implement this manually(?) On Windows, there should be std::os::windows module. Unfortunately, I don't use Windows, so it's a little hard to reproduce but are you able to compile exa with an older version (e.g. 2018) of Rust?

The build naturally shouldn't go further due to the users crate implementing a lot of other functions that don't exist in Windows or are implemented in different ways. If the build is possible with Rust 2018, then it might be changes in Rust and now crates need to adapt according to the platform.

fnuttens commented 1 year ago

It seems like users crate needs to implement this manually(?)

What do you mean? From my understanding, this crate has nothing to do with Windows, so it makes sense that it is unable to compile on this platform.

are you able to compile exa with an older version (e.g. 2018) of Rust?

Yup, I only have this problem with Rust 2021. So maybe it's an issue with Rust itself, like you said.

skyline75489 commented 1 year ago

I can't reproduce this locally. Are you using nightly?

fnuttens commented 1 year ago

Huh that's weird.. I just gave it another try and it actually worked 😅

Are you using nightly?

No, as far as I can tell, but now that it works again I wonder if I might have done something wrong... It is weird though, because I don't remember doing anything other than git pull and cargo install --path ....

Anyways I feel a bit silly now, feel free to ignore or close this issue 🙈

Gbps commented 1 year ago

Experiencing the same issue on both nightly rustc 1.71.0-nightly (c4190f2d3 2023-05-07) and stable rustc 1.69.0 (84c898d65 2023-04-16).

Repro is simply cargo install exa on a Windows 11 machine.

error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\a\.cargo\registry\src\index.crates.io-6f17d22bba15001f\users-0.11.0\src\base.rs:36:14
   |
36 | use std::os::unix::ffi::OsStrExt;
   |              ^^^^ could not find `unix` in `os`
eloc3147 commented 1 year ago

@Gbps Windows compatibility has not been tagged as a release or pushed to crates.io yet. So cargo install exa will fail on Windows. To build on Windows now, you need to pull from git and build that

eloc3147 commented 1 year ago

I can also confirm I can build the above referenced commit (89bcc00) on Windows 11

bitzl commented 1 year ago

I can confirm that the build works for https://github.com/ogham/exa/commit/89bcc00e323c37d82d8fe0c924d281a25e8bfbf3 and https://github.com/ogham/exa/commit/HEAD, building with and without --release. Can we close this issue?