Skip to content

Building Rust binaries

Ryan Parman edited this page Oct 23, 2024 · 4 revisions

musl vs glibc

Like C, Rust is a low-level language. Also like C, many Rust programs appear to rely on the system's libc implementation. In practice, this means separate binaries for Alpine Linux vs other linuxes.

Check the Alpine Linux package repositories for a package first. If they're already packaging it, we should skip the duplicated effort unless their repositories are WAY behind.

Are there releases available?

If we can pull tarballed releases from GitHub, that's preferable.

With Rust, we often see a matrix of [gnu, musl] and [aarch64, x86_64]. I often see 3/4 of these builds as release assets. The one usually missing is aarch64 for musl. Some packages like lychee have one, but they don't label it clearly with aarch64. I ended up figuring it out by looking at their Dockerfile. You may need to do some investigation to figure this out.

serde_derive is unbuildable when virtualized

While we have the right things in-place to be able to build [aarch64, x86_64] on musl, the serde_derive crate takes so damn long to build cross-architecture.

GitHub Actions only provides x86_64 runners, so we've started using Ubicloud for arm64 runners. Make sure that Rust projects are always built natively, and do not rely on virtualization.