Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross build aarch64-pc-windows-msvc from x86_64-pc-windows-msvc without using cargo-xwin #1644

Open
Myriad-Dreamin opened this issue Dec 17, 2024 · 4 comments

Comments

@Myriad-Dreamin
Copy link

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.

@mistydemeo
Copy link
Contributor

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.

@Myriad-Dreamin
Copy link
Author

Myriad-Dreamin commented Dec 18, 2024

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.

@Myriad-Dreamin
Copy link
Author

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

@messense
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants