diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af2d95cd0e6e..34a1767bc7b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -266,7 +266,7 @@ jobs: RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup run: | rustup target add x86_64-pc-windows-msvc - rustup component add clippy rust-src --toolchain nightly-2024-03-19-x86_64-pc-windows-msvc + rustup component add clippy rust-src --toolchain nightly-2024-05-27-x86_64-pc-windows-msvc - uses: rui314/setup-mold@v1 diff --git a/crates/install-wheel-rs/src/lib.rs b/crates/install-wheel-rs/src/lib.rs index 6bd39f7c4996..9c748e8006ed 100644 --- a/crates/install-wheel-rs/src/lib.rs +++ b/crates/install-wheel-rs/src/lib.rs @@ -70,7 +70,9 @@ pub enum Error { RecordCsv(#[from] csv::Error), #[error("Broken virtualenv: {0}")] BrokenVenv(String), - #[error("Unable to create Windows launcher for {0} (only x64_64 is supported)")] + #[error( + "Unable to create Windows launcher for: {0} (only x86_64, x86, and arm64 are supported)" + )] UnsupportedWindowsArch(&'static str), #[error("Unable to create Windows launcher on non-Windows platform")] NotWindows, diff --git a/crates/install-wheel-rs/src/wheel.rs b/crates/install-wheel-rs/src/wheel.rs index 9f9c52da107c..b0ea1397a692 100644 --- a/crates/install-wheel-rs/src/wheel.rs +++ b/crates/install-wheel-rs/src/wheel.rs @@ -23,6 +23,14 @@ use crate::{Error, Layout}; const LAUNCHER_MAGIC_NUMBER: [u8; 4] = [b'U', b'V', b'U', b'V']; +#[cfg(all(windows, target_arch = "x86"))] +const LAUNCHER_I686_GUI: &[u8] = + include_bytes!("../../uv-trampoline/trampolines/uv-trampoline-i686-gui.exe"); + +#[cfg(all(windows, target_arch = "x86"))] +const LAUNCHER_I686_CONSOLE: &[u8] = + include_bytes!("../../uv-trampoline/trampolines/uv-trampoline-i686-console.exe"); + #[cfg(all(windows, target_arch = "x86_64"))] const LAUNCHER_X86_64_GUI: &[u8] = include_bytes!("../../uv-trampoline/trampolines/uv-trampoline-x86_64-gui.exe"); @@ -161,6 +169,14 @@ pub(crate) fn windows_script_launcher( } let launcher_bin: &[u8] = match env::consts::ARCH { + #[cfg(all(windows, target_arch = "x86"))] + "x86" => { + if is_gui { + LAUNCHER_I686_GUI + } else { + LAUNCHER_I686_CONSOLE + } + } #[cfg(all(windows, target_arch = "x86_64"))] "x86_64" => { if is_gui { diff --git a/crates/uv-trampoline/README.md b/crates/uv-trampoline/README.md index 06ee577e6da1..883b2e8ea6c7 100644 --- a/crates/uv-trampoline/README.md +++ b/crates/uv-trampoline/README.md @@ -11,6 +11,7 @@ package manager to install LLD and add the `rustup` targets: ```shell sudo apt install llvm clang lld +rustup target add i686-pc-windows-msvc rustup target add x86_64-pc-windows-msvc rustup target add aarch64-pc-windows-msvc ``` @@ -18,8 +19,9 @@ rustup target add aarch64-pc-windows-msvc Then, build the trampolines for both supported architectures: ```shell -cargo +nightly-2024-03-19 xwin build --release --target x86_64-pc-windows-msvc -cargo +nightly-2024-03-19 xwin build --release --target aarch64-pc-windows-msvc +cargo +nightly-2024-05-27 xwin build --xwin-arch x86 --release --target i686-pc-windows-msvc +cargo +nightly-2024-05-27 xwin build --release --target x86_64-pc-windows-msvc +cargo +nightly-2024-05-27 xwin build --release --target aarch64-pc-windows-msvc ``` ### Cross-compiling from macOS @@ -29,6 +31,7 @@ package manager to install LLVM and add the `rustup` targets: ```shell brew install llvm +rustup target add i686-pc-windows-msvc rustup target add x86_64-pc-windows-msvc rustup target add aarch64-pc-windows-msvc ``` @@ -36,8 +39,9 @@ rustup target add aarch64-pc-windows-msvc Then, build the trampolines for both supported architectures: ```shell -cargo +nightly-2024-03-19 xwin build --release --target x86_64-pc-windows-msvc -cargo +nightly-2024-03-19 xwin build --release --target aarch64-pc-windows-msvc +cargo +nightly-2024-05-27 xwin build --release --target i686-pc-windows-msvc +cargo +nightly-2024-05-27 xwin build --release --target x86_64-pc-windows-msvc +cargo +nightly-2024-05-27 xwin build --release --target aarch64-pc-windows-msvc ``` ### Updating the prebuilt executables @@ -49,6 +53,8 @@ cp target/aarch64-pc-windows-msvc/release/uv-trampoline-console.exe trampolines/ cp target/aarch64-pc-windows-msvc/release/uv-trampoline-gui.exe trampolines/uv-trampoline-aarch64-gui.exe cp target/x86_64-pc-windows-msvc/release/uv-trampoline-console.exe trampolines/uv-trampoline-x86_64-console.exe cp target/x86_64-pc-windows-msvc/release/uv-trampoline-gui.exe trampolines/uv-trampoline-x86_64-gui.exe +cp target/i686-pc-windows-msvc/release/uv-trampoline-console.exe trampolines/uv-trampoline-i686-console.exe +cp target/i686-pc-windows-msvc/release/uv-trampoline-gui.exe trampolines/uv-trampoline-i686-gui.exe ``` ### Testing the trampolines @@ -167,6 +173,7 @@ might not realize that, and still emit references to the unwinding helper exist. ``` +cargo build --release --target i686-pc-windows-msvc cargo build --release --target x86_64-pc-windows-msvc cargo build --release --target aarch64-pc-windows-msvc ``` diff --git a/crates/uv-trampoline/rust-toolchain.toml b/crates/uv-trampoline/rust-toolchain.toml index e51a32bf63a3..b933c66a7671 100644 --- a/crates/uv-trampoline/rust-toolchain.toml +++ b/crates/uv-trampoline/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2024-03-19" +channel = "nightly-2024-05-27" diff --git a/crates/uv-trampoline/trampolines/uv-trampoline-i686-console.exe b/crates/uv-trampoline/trampolines/uv-trampoline-i686-console.exe new file mode 100755 index 000000000000..33de099f42bb Binary files /dev/null and b/crates/uv-trampoline/trampolines/uv-trampoline-i686-console.exe differ diff --git a/crates/uv-trampoline/trampolines/uv-trampoline-i686-gui.exe b/crates/uv-trampoline/trampolines/uv-trampoline-i686-gui.exe new file mode 100755 index 000000000000..119c4f19d72d Binary files /dev/null and b/crates/uv-trampoline/trampolines/uv-trampoline-i686-gui.exe differ