Skip to content

Cross-Platform Support

Tested Environments

EnvironmentBuild TargetShellHOMEStatus
macOS arm64native/bin/sh (zsh)always setTested
macOS x86_64native/bin/sh (zsh)always setTested
Ubuntu 22.04x86_64-unknown-linux-gnu/bin/sh (dash)usually setTested
Ubuntu 24.04x86_64-unknown-linux-gnu/bin/sh (dash)usually setTested
Alpine 3.xx86_64-unknown-linux-musl/bin/sh (busybox ash)usually setTested
LXC containermatches hostvariesoften missing/etc/passwd fallback
Proxmox VE hostx86_64-unknown-linux-gnu/bin/sh (dash)setTested
systemd servicematches hostvariesoften missing/etc/passwd fallback
cron jobmatches hostvariesoften missing/etc/passwd fallback

Build Targets

macOS (native)

sh
cargo build --release
# produces: target/release/l0-cache (arm64 or x86_64, depending on host)

Linux glibc (Ubuntu, Debian, RHEL)

sh
cargo build --release --target x86_64-unknown-linux-gnu

Requires a Linux cross-compiler if building from macOS. The Makefile handles this automatically.

Linux musl (Alpine, containers)

sh
CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \
cargo build --release --target x86_64-unknown-linux-musl

Produces a fully static binary with no runtime dependencies. This is the recommended build for containers and minimal environments.

Shell Compatibility

The 2>&1 redirect and single-quote escaping used by l0-cache are POSIX sh compatible. They work identically on:

  • dash (Ubuntu default /bin/sh)
  • bash (common on RHEL, macOS pre-Catalina)
  • zsh (macOS default since Catalina)
  • busybox ash (Alpine default /bin/sh)

The only environment where this fails is distroless containers or scratch images that have no shell at all. In that case, use l0-cache -i for passthrough mode (no 2>&1 merge).

HOME Resolution

l0-cache resolves the data directory in this order:

  1. $XDG_DATA_HOME/l0-cache/
  2. $HOME/.local/share/l0-cache/
  3. /etc/passwd lookup using the current UID

The /etc/passwd fallback handles:

  • lxc exec container -- l0-cache cargo test (no $HOME)
  • Cron jobs without HOME= in the crontab
  • systemd services without User= (runs as root, $HOME may not be set)