tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.54k stars 2.44k forks source link

Support Windows on ARM64 #2985

Open Alovchin91 opened 3 years ago

Alovchin91 commented 3 years ago

Is your feature request related to a problem? Please describe. Rust has recently promoted Windows on ARM64 (aarch64-pc-windows-msvc) platform to Tier 2 Development Platform. Since tokio is one of the most essential crates in Rust ecosystem, it's important that it supports Windows on ARM64 as a target platform. Right now however it's not possible to compile tokio for aarch64-pc-windows-msvc target. Unfortunately this means that I currently cannot build many Rust projects natively for my Surface Pro X.

Describe the solution you'd like The reason seems to be a single crate in mio's dependency tree: ntapi. I've managed to implement the missing support (which seems to be very straightforward) and open a Pull Request to that project. After that, I've managed to build tokio without problem and run all the tests. After a second run all tests succeeded (on the first run one timer test failed but the machine was under heavy load atm). Shall the Pull Request be merged, no actions should be required. I would like to track the progress in this issue however so I could help keep tokio tested for Windows on ARM64, and to keep the discussion open shall the Pull Request not be merged or other issues arise.

Describe alternatives you've considered -

Additional context -

Darksonn commented 3 years ago

Once our dependencies support the platform, it would be nice to add the platform to our CI setup, if possible.

Alovchin91 commented 3 years ago

The mentioned Pull Request has been merged!

Now I can build tokio from master for Windows on ARM64 without any patches 👍

@Darksonn How complicated would it be to add the platform to the CI? I think it has to be cross-compilation for now, since there are no Windows on ARM runners anywhere yet.

Alovchin91 commented 3 years ago

Also, I keep seeing the test no_out_of_bounds_close_to_max fail from time to time:

thread 'no_out_of_bounds_close_to_max' panicked at 'timer error: timer duration exceeds maximum duration', tokio\src\time\sleep.rs:130:23

I think I've found some pattern here. The test seems to fail every time cargo has to download some dependencies. When all the dependencies are up to date, the test succeeds.

Please see the attached log file for the detailed tests run.

Does it make sense to open a separate issue for this flaky test?

tokio_aarch64_build.log

Darksonn commented 3 years ago

Yes, open an issue about it. As for CI, if there's no runner, we will have to make do with just compiling it. We already have some of that:

https://github.com/tokio-rs/tokio/blob/e804f88d60071f0d89db85aaa4a073857904b545/.github/workflows/ci.yml#L131-L153

Alovchin91 commented 3 years ago

Just run all the tests on Tokio v1.0.0 and didn't see the issue with the test anymore 👍

I'm gonna see if I can add Windows aarch64 cross build to ci.yml now. It's a shame there are no arm64 Windows builders, but hey, v1.0.0 works! 🎉