Skip to content
Latchkey

What Is Static Linking?

Static linking copies the code of required libraries into the executable at build time, so the resulting binary contains everything it needs to run. There is no dependency on those libraries being present on the target system. This produces larger but fully self-contained artifacts that are easy to deploy.

Why it matters

A statically linked binary runs on a bare or minimal system, such as a distroless or scratch container image, without installing shared libraries, which simplifies deployment and avoids dependency-version mismatches. The trade-offs are larger binaries and the need to rebuild to pick up a library security fix.

Related concepts

  • Opposite of dynamic linking
  • Enables minimal, distroless container images
  • Library fixes require a rebuild, not just an update

Related guides

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