Skip to content

Commit 9e6b813

Browse files
committed
ci: build Windows natively with mingw-w64 instead of cross
The cross main image for x86_64-pc-windows-gnu is still based on Ubuntu 20.04 (glibc 2.31). After the Linux job moved to a native build on ubuntu-22.04 (glibc 2.35), Swatinem/rust-cache started sharing entries between the two matrix variants because its key only varies by runner OS, not by cross-compile target. The Windows job then restored host-built build scripts linked against glibc 2.32+ and tried to execute them inside the cross container, which fails with GLIBC_2.32+ symbol-not-found errors. The project doesn't actually need anything cross provides beyond the mingw-w64 toolchain itself, so swap cross for a plain apt install of gcc-mingw-w64-x86-64 and let dtolnay/rust-toolchain pull in the matching rustup target. Also scope the rust-cache key to matrix.target so the Linux and Windows builds keep separate caches.
1 parent dc62595 commit 9e6b813

4 files changed

Lines changed: 21 additions & 19 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,24 @@ jobs:
7777
matrix:
7878
include:
7979
- target: linux-x64
80-
runner: ubuntu-22.04
80+
rust_target: x86_64-unknown-linux-gnu
8181
- target: windows-x64
82-
runner: ubuntu-latest
82+
rust_target: x86_64-pc-windows-gnu
8383

84-
runs-on: ${{ matrix.runner }}
84+
runs-on: ubuntu-22.04
8585

8686
steps:
8787
- name: Checkout
8888
uses: actions/checkout@v6
8989

9090
- name: Install Rust Stable
9191
uses: dtolnay/rust-toolchain@stable
92+
with:
93+
targets: ${{ matrix.rust_target }}
9294

9395
- uses: Swatinem/rust-cache@v2
96+
with:
97+
key: ${{ matrix.target }}
9498

9599
- name: Update version
96100
run: |
@@ -103,22 +107,22 @@ jobs:
103107
if [ "${{ matrix.target }}" == "linux-x64" ]; then
104108
sudo apt-get update
105109
sudo apt-get install --assume-yes libdbus-1-dev libfontconfig1-dev
106-
cargo build --release --target x86_64-unknown-linux-gnu
110+
cargo build --release --target ${{ matrix.rust_target }}
107111
else
108-
cargo install cross --git https://github.com/cross-rs/cross
109-
cross build --release --target x86_64-pc-windows-gnu
110-
sudo apt-get install --assume-yes osslsigncode
112+
sudo apt-get update
113+
sudo apt-get install --assume-yes gcc-mingw-w64-x86-64 osslsigncode
114+
cargo build --release --target ${{ matrix.rust_target }}
111115
echo "${{ secrets.WIN_SIGN_KEY }}" | base64 -d > code_sign.key.pem
112116
echo "${{ secrets.WIN_SIGN_CERT }}" | base64 -d > code_sign.cert.pem
113-
mkdir ./target/x86_64-pc-windows-gnu/signed
117+
mkdir ./target/${{ matrix.rust_target }}/signed
114118
osslsigncode sign \
115119
-certs code_sign.cert.pem \
116120
-key code_sign.key.pem \
117121
-n "VRC OSC Manager" \
118122
-i https://github.com/DASPRiD/vrc-osc-manager/ \
119123
-t http://timestamp.sectigo.com \
120-
-in ./target/x86_64-pc-windows-gnu/release/vrc-osc-manager.exe \
121-
-out ./target/x86_64-pc-windows-gnu/signed/vrc-osc-manager.exe
124+
-in ./target/${{ matrix.rust_target }}/release/vrc-osc-manager.exe \
125+
-out ./target/${{ matrix.rust_target }}/signed/vrc-osc-manager.exe
122126
fi
123127
shell: bash
124128

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ cargo fmt --all -- --check
2727
# Format fix
2828
cargo fmt --all
2929

30-
# Cross-compile for Windows from Linux
31-
cross build --target x86_64-pc-windows-gnu --release
30+
# Cross-compile for Windows from Linux (requires gcc-mingw-w64-x86-64)
31+
rustup target add x86_64-pc-windows-gnu
32+
cargo build --target x86_64-pc-windows-gnu --release
3233
```
3334

3435
There are no tests in this project.

Cross.toml

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ This is an OSC manager for handling multiple VRChat OSC plugins at once.
99
When compiling the application, it will include all plugins by default. You can opt into only including specific plugins
1010
by only enabling the features you want. For a full list of features, have a look at the `Cargo.toml` file.
1111

12-
In order to cross-compile from Linux for Windows, run the following command:
12+
In order to cross-compile from Linux for Windows, install the mingw-w64 toolchain (e.g. `apt install
13+
gcc-mingw-w64-x86-64`), then run:
1314

1415
```bash
15-
cross build --target x86_64-pc-windows-gnu --release
16+
rustup target add x86_64-pc-windows-gnu
17+
cargo build --target x86_64-pc-windows-gnu --release
1618
```
1719

1820
## Usage

0 commit comments

Comments
 (0)