kiuber/cargo-xwin provides a ready-to-use Linux-based build environment for cross-compiling Rust/PyO3 Python wheels to Windows MSVC targets.
It bundles the tooling commonly needed for this workflow, such as cargo-xwin and maturin, so you can build Windows wheels from a Linux host or CI pipeline with a simple Docker command.
This image is especially useful for:
x86_64-pc-windows-msvc wheels on Linuxdocker run --rm -it \
-v $(pwd):/io \
-w /io \
kiuber/cargo-xwin \
maturin build --release --target x86_64-pc-windows-msvc --out wheelhouse
cd /tmp && git clone https://github.com/PyO3/pyo3.git
cd pyo3
docker run --rm -it \
-v $(pwd):/work \
-w /work/examples/maturin-starter \
kiuber/cargo-xwin \
maturin build \
--release \
--target x86_64-pc-windows-msvc \
--out wheelhouse \
-i python3.10
Cloning into 'pyo3'...
remote: Enumerating objects: 66232, done.
remote: Counting objects: 100% (388/388), done.
remote: Compressing objects: 100% (283/283), done.
remote: Total 66232 (delta 256), reused 105 (delta 105), pack-reused 65844 (from 4)
Receiving objects: 100% (66232/66232), 55.41 MiB | 18.54 MiB/s, done.
Resolving deltas: 100% (50311/50311), done.
Updating crates.io index
Locking 14 packages to latest compatible versions
Downloaded heck v0.5.0
Downloaded quote v1.0.45
Downloaded once_cell v1.21.4
Downloaded unicode-ident v1.0.24
Downloaded proc-macro2 v1.0.106
Downloaded target-lexicon v0.13.5
Downloaded syn v2.0.117
Downloaded libc v0.2.185
Downloaded 8 crates (1.3MiB) in 0.51s
š¹ Building a mixed python/rust project
š Found pyo3 bindings
š Found CPython 3.10
š ļø Using xwin for cross-compiling to x86_64-pc-windows-msvc
Compiling target-lexicon v0.13.5
Compiling proc-macro2 v1.0.106
Compiling quote v1.0.45
Compiling unicode-ident v1.0.24
Compiling libc v0.2.185
Compiling heck v0.5.0
Compiling once_cell v1.21.4
Compiling pyo3-build-config v0.28.3 (/work/pyo3-build-config)
Compiling syn v2.0.117
Compiling pyo3-ffi v0.28.3 (/work/pyo3-ffi)
Compiling pyo3 v0.28.3 (/work)
Compiling pyo3-macros-backend v0.28.3 (/work/pyo3-macros-backend)
Compiling pyo3-macros v0.28.3 (/work/pyo3-macros)
Compiling maturin-starter v0.1.0 (/work/examples/maturin-starter)
Finished `release` profile [optimized] target(s) in 5.81s
š¦ Built wheel for CPython 3.10 to wheelhouse/maturin_starter-0.1.0-cp310-cp310-win_amd64.whl
Content type
Image
Digest
sha256:e48190c39ā¦
Size
1.9 GB
Last updated
4 months ago
docker pull kiuber/cargo-xwin