-
Notifications
You must be signed in to change notification settings - Fork 455
xtask/build_docker_image: Add windows/amd64 platform handling#1672
xtask/build_docker_image: Add windows/amd64 platform handling #1672MarijnS95 wants to merge 1 commit into
windows/amd64 platform handling #1672Conversation
@Emilgardis
Emilgardis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, minor nit about the todo comment
regarding buildx/buildkit, there's experimental support for it, see this list for their progress: https://github.com/moby/buildkit/issues?q=is%3Aissue%20state%3Aopen%20label%3Aarea%2Fwindows-wcow
and this issue for the popular setup-buildx-action https://redirect.github.com/docker/setup-buildx-action/issues/292
As listed at for example https://docs.docker.com/build/building/multi-platform/. Allows using `--platform windows/amd64` rather than `--platform x86_64-pc-windows-msvc`.
359863b to
7e1105f
Compare
MarijnS95
commented
Apr 28, 2025
@Emilgardis thanks, so it's buildx that doesn't support Windows just yet.
What's the right way to use this cross project for an aarch64-pc-windows-msvc target? As far as I'm aware Docker is "not intended" to emulate Windows on Linux despite having QEMU available to emulate the aarch64 architecture, and at the same time buildx cannot be used on Windows yet (and if it is, what's the setup for emulating aarch64 on an x64 GitHub Actions runner)?
As far as I understand cross also uses the container (and/or emulation?) to cross-compile? Otherwise we still have a setup to cross-compile (for various Windows MSVC targets/architectures) with the native compiler using https://github.com/Jake-Shadle/xwin/, but that (obviously) isn't able to (削除) run (削除ここまで) emulate tests etc.
Emilgardis
commented
Apr 28, 2025
We have a msvc image here already, we just don't publish its not certain it's actually any good: https://github.com/cross-rs/cross-toolchains/blob/main/docker/Dockerfile.aarch64-pc-windows-msvc-cross, it does not use the container platform windows. it uses linux, so yes, it's cross compilation.
cross in general does not compile through emulation, we cross-compile. Although, we do emulation on aarch64 hosts for now because we don't have the infrastructure rn to make linux/arm64 images published (see #1636)
MarijnS95
commented
Apr 30, 2025
@Emilgardis thanks for confirming, I see now (should have opened the docker image before): it's emulating native MSVC in an Ubuntu Docker image on wine, hence should run in a Docker container on a Linux/Ubuntu GitHub runner 👍
Trying this now on my dev machine, it is bindmounting ~/.cargo and conflicting with my aforementioned xwin+clang-based setup from [target.aarch64-pc-windows-msvc] + [env] in ~/.cargo/config.toml (need to comment it out, it's fortunately not present on the CI though).
It's also surprising that cross build --target=aarch64-pc-windows-msvc first tries to install the stable-x86_64-unknown-linux-gnu (native host) toolchain before spawning a docker container and continuing with the Windows target there.
Finally, the Dockerfile.aarch64-pc-windows-msvc you linked looks to be missing BINDGEN_EXTRA_CLANG_ARGS so bindgen is failing with obvious errors like "stdint.h not found"...
Uh oh!
There was an error while loading. Please reload this page.
As listed at for example https://docs.docker.com/build/building/multi-platform/.
Allows using
--platform windows/amd64rather than--platform x86_64-pc-windows-msvc.I didn't manage to use this in GitHub Actions CI on
windows-latestjust yet because it complains that--platformis not understood, and the help text suggests thatbuildxisn't installed in these images in the first place:Docker-Buildx)Docker-Buildx)