Closed asilano closed 3 years ago
The issue seems to be due to how 'non-monitonic clocks' are handled (as introduced by https://github.com/rust-lang/rust/pull/56988)
Rust treats the Winodws system clock as potentially non-monotonic, in order to work around some weird system clock issues. However, since you're running Rust under WSL, you're running Rust built for Linux, which is treated as having a proper monotonic clock.
My guess is that WSL simply forwards gettimeofday
to the underlying Windows clock, with all of the issues that entails.
That makes sense. Is there any way around this?
Since WSL runs unmodified Linux binaries, I think Rust will need to do runtime detection of WSL
I decided to debug a Rust program which was not working correctly on Windows. Wanted to see the correct behavior on Linux first, so I tried to compile it with 1.33.0-x86_64-unknown-linux-gnu
and got the same stack trace as above. I installed older toolchains one by one until 1.30.0-x86_64-unknown-linux-gnu
finally was able to download the dependencies:
$ rustup update 1.30.0
$ rustup run 1.30.0 cargo install thecrate
...
this Cargo does not support nightly features, but if you
switch to nightly channel you can add
`cargo-features = ["rename-dependency"]` to enable this feature
I think I'll wait for a better day to do Rust development.
It is now useful to specify WSL1 vs WSL2. WSL1 uses the Windows APIs to fulfill Linux API calls. WSL2, as I understand it, directs such syscalls through a Linux kernel atop the Virtual Machine Platform. If this is a defect in WSL1, it is a known defect, and it is recommended to use WSL2 instead. In the light of that, I believe we can close this issue for now.
Of course, if I have missed something, then I would appreciate it if you reopened this with more information.
After installing the latest rust via rustup (
--version
reports 1.34.1), I followed the instructions at https://github.com/rust-lang/rustlings/ to get the rustlings tutorial running. The cargo install fails with:It fails this way every time, although the "Downloaded" crate changes (it seems to manage to start the downloads, but fails quickly).
I'm not familiar with Rust's internals at all - let me know if I can generate more useful diags!