Cross build `aarch64-pc-windows-msvc` from `x86_64-pc-windows-msvc` without using `cargo-xwin`
First, thanks for the awesome project. It does save me a lot of time to setup and release targets and the generated announcement looks beautiful. However, I had a hard time to build with cargo-dist, I put some feedback here.
Problem
My first problem is that cargo-xwin is too old to build my binaries:
https://github.com/Myriad-Dreamin/tinymist/actions/runs/12358673816/job/34489776246
Here is the critical log line:
error: rustc 1.79.0 is not supported by the following packages:
[email protected] requires rustc 1.82
My Temporary Solution
However, I also find that there is no problem to just run cargo build --target aarch64-pc-windows-msvc from x86_64-pc-windows-msvc for my binaries. I therefore changed cargo-dist/src/tasks.rs:
@@ -486,6 +506,10 @@ pub fn build_wrapper_for_cross(
// compiling for Windows (making PE binaries, .dll files, etc.)
OperatingSystem::Windows => match host.operating_system {
+ OperatingSystem::Windows => {
+ // from win to win, it is okay for my binaries
+ Ok(None)
+ }
OperatingSystem::Linux | OperatingSystem::Darwin => {
// cargo-xwin is made for that
}
Proposed Improvement
It should be great if cargo-dist can provide me some twist to not using cargo-xwin if I don't have to. If we can already have a nice way to solve it, please let me know.
Interesting, I didn't realize Windows-to-Windows cross compiling could work this well without a wrapper! We can do some more testing and see if we should promote this to the default, but at a minimum we should make sure we recognize it.
Sorry, just to add a note. When I back to read the issue, I might being encoding some wrong knowledge. The reason that my first shoot uses Windows-to-Windows method was is just because we were doing that in our old CI script. I have no idea about reason we don't use Linux-to-Windows. If you are interested, you could also check Linux-to-Windows, to make it clearer.
Also put some information, the cargo.lock. These crates should work pretty, because the software using it has been used on thousands of windows PC. Some heavy crates:
-
reqwest+rustls: network -
tokio: async -
rayon: multi-thread functions
Windows-to-Windows cross compiling works pretty well generally, one thing to note is that ring requires clang to target aarch64 Windows:
https://github.com/briansmith/ring/blob/e3b72456313783513e95cd929c3d73d74a33fb5c/build.rs#L550-L553