Skip to content

ci: add a Linux aarch64 build - #331

Open
WizzardSK wants to merge 1 commit into
doublegate:mainfrom
WizzardSK:ci-linux-aarch64
Open

ci: add a Linux aarch64 build#331
WizzardSK wants to merge 1 commit into
doublegate:mainfrom
WizzardSK:ci-linux-aarch64

Conversation

@WizzardSK

@WizzardSK WizzardSK commented Jul 28, 2026

Copy link
Copy Markdown

Adds a libretro-build-linux-aarch64 job so the core lands in nightly/linux/aarch64/ on the buildbot, where it is currently missing.

Why it is not a one-liner

There is no rust-linux-aarch64.yml template in ci-templates — only rust-linux-x64.yml — and libretro-build-rust is FROM libretro-build-amd64-ubuntu, so there is no native aarch64 image to point at either. I raised that gap as libretro/libretro-super#2030.

So this job cross-compiles from the same image the x64 job already uses, in the style that image already uses for its other arm64 targets (CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER and friends): add the target, point CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER at aarch64-linux-gnu-gcc, and override STRIP, since the template's default strip is host binutils (rust-webos.yml does the same for its ARM targets). .libretro-rust-linux-x64 is extended rather than -default, since that is what pins TARGET_ARCH to x86_64.

I read the #91899 post-mortem before writing this. The job declares RUST_TARGET like every other one and runs rustup target add ${RUST_TARGET}, so the rust-toolchain.toml pin gets its rust-std for aarch64 the same way; it spells the before_script out rather than extending .rust-target-install only because the cross linker has to be apt-installed in the same block. Nothing is added to targets in rust-toolchain.toml, per the note there.

If a rust-linux-aarch64.yml template ever lands, this job collapses to an extends: line.

Tested on real aarch64 hardware

Built and run natively on an aarch64 Linux machine (Snapdragon 7c / SC7180, postmarketOS), target aarch64-unknown-linux-gnu. Worth noting for the pin: rustup honoured rust-toolchain.toml and pulled a fresh 1.96.0 aarch64 toolchain on its own, and the build was clean on it.

  • no source changes neededcargo build --release --target aarch64-unknown-linux-gnu is clean across all the workspace crates (cpu, ppu, apu, mappers, core, libretro)
  • librustynes.so, ELF 64-bit LSB shared object, ARM aarch64, 1.9 MB
  • in RetroArch: a homebrew NES ROM boots and plays with correct colours, 60.13 fps against the core's 60.0988 target — full speed
  • 600 frames, exit code 0, no crash

One aside, unrelated to this PR: the core cannot be driven by a minimal libretro host that calls retro_set_environment before retro_init. rust-libretro 0.3.2 panics there with retro_set_environment: Core has not been initialized yet! (rust-libretro-0.3.2/src/lib.rs:432). RetroArch happens to call them in the other order so it never trips, but a stricter frontend would. That is upstream rust-libretro, not this repo — flagging it only because it cost me a confusing crash while benchmarking.

What I could not test: I built natively on aarch64, whereas this job cross-compiles from x86_64. I also cannot run GitLab pipelines from a GitHub PR, so the job itself has not been executed by CI yet.

Summary by CodeRabbit

  • New Features
    • Added automated Linux ARM64 builds for the libretro core.
    • The new build configuration cross-compiles the core for aarch64-unknown-linux-gnu, enabling support for ARM64 environments.

There is no rust-linux-aarch64.yml template yet
(libretro/libretro-super#2030) and the rust build image is amd64-only, so
this cross-compiles from that image the same way it already cross-compiles
the Apple and Android arm64 targets: add the target, the cross linker via
CARGO_TARGET_*_LINKER, and an aarch64 strip.

before_script inlines the rustup target add rather than extending
.rust-target-install, since the cross linker has to be apt-installed in the
same block; the toolchain-pin handling from the #91899 post-mortem is
unchanged.
@WizzardSK
WizzardSK requested a review from doublegate as a code owner July 28, 2026 16:30
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: faf98673-1007-4db8-9e8d-9dea9301b55c

📥 Commits

Reviewing files that changed from the base of the PR and between a1df7b9 and 20eb50b.

📒 Files selected for processing (1)
  • .gitlab-ci.yml
 ___________________________________________________________________________________________________________________________________
< Don't use manual procedures. A shell script or batch file will execute the same instructions, in the same order, time after time. >
 -----------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant