Skip to content

Commit 5888286

Browse files
committed
fix(ci): add cross-compilation toolchain for aarch64-linux-gnu
Install gcc-aarch64-linux-gnu and set CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER to fix the release workflow failing with "failed to find tool aarch64-linux-gnu-gcc" when cross-compiling vite_global_cli from x86_64 to aarch64.
1 parent c5f4e92 commit 5888286

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ rustflags = ["--cfg", "tokio_unstable"] # also update .github/workflows/ci.yml
88
[target.'cfg(target_os = "linux")']
99
rustflags = ["--cfg", "tokio_unstable", "-C", "link-args=-Wl,--warn-unresolved-symbols"]
1010

11+
# Required for aarch64-linux-gnu-gcc linker on Ubuntu x86_64
12+
[target.aarch64-unknown-linux-gnu]
13+
linker = "aarch64-linux-gnu-gcc"
14+
1115
[unstable]
1216
bindeps = true
1317

.github/actions/build-upstream/action.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,17 @@ runs:
8282
env:
8383
DEBUG: napi:*
8484

85-
- name: Build Rust CLI binary
86-
if: steps.cache-restore.outputs.cache-hit != 'true'
85+
- name: Build Rust CLI binary (aarch64-linux)
86+
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
87+
shell: bash
88+
run: |
89+
# Install aarch64 cross-compilation toolchain
90+
sudo apt-get update
91+
sudo apt-get install -y gcc-aarch64-linux-gnu
92+
cargo build --release --target ${{ inputs.target }} -p vite_global_cli
93+
94+
- name: Build Rust CLI binary (other targets)
95+
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target != 'aarch64-unknown-linux-gnu'
8796
shell: bash
8897
run: cargo build --release --target ${{ inputs.target }} -p vite_global_cli
8998

0 commit comments

Comments
 (0)