Skip to content
Latchkey

Rust "ring" Build Failures - Missing Assembler/Compiler in CI

The ring crate (pulled in by rustls and many TLS stacks) compiles bundled C and assembly in its build script, so it needs a C compiler, perl, and a toolchain that supports the target. On a minimal or cross-compiling runner, one of those is missing and the build script fails.

What this error means

A build using ring (directly or via rustls) fails in failed to run custom build command for ring, with the script’s stderr pointing at a missing cc/perl, an assembler error, or an unsupported cross target. Pure-Rust crates compile; only ring’s native build fails.

cargo output
error: failed to run custom build command for `ring v0.17.8`

  --- stderr
  thread 'main' panicked at 'failed to execute "perl": No such file or directory'
  # or, cross: error: unsupported target for prebuilt asm; cc not found for target

Common causes

Missing cc/perl for ring’s build script

ring builds C and assembly at compile time; its build script invokes a C compiler and perl. A slim image without build-essential/perl makes the script fail.

Cross/wasm target without the right toolchain

Cross-compiling or targeting wasm needs a compatible C toolchain (and sometimes a supported target) for ring’s native code. Without it, the assembly/C build can’t complete.

How to fix it

Install ring’s build dependencies

Terminal
# Debian/Ubuntu
apt-get update && apt-get install -y build-essential perl
# Alpine
apk add --no-cache build-base perl

Or avoid ring with an alternative backend

Some stacks let you swap ring for aws-lc-rs or use a non-ring TLS backend, sidestepping the native build.

Cargo.toml
# rustls can use the aws-lc-rs backend instead of ring
[dependencies]
rustls = { version = "0.23", default-features = false, features = ["aws-lc-rs"] }

How to prevent it

  • Bake build-essential and perl into images that build ring/rustls.
  • Use cross/cargo-zigbuild for ring on cross or musl targets.
  • Consider an aws-lc-rs or non-ring TLS backend where supported.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →