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
What Is Dynamic Linking?Dynamic linking resolves a program's library dependencies at load time from shared libraries on the system, r…
What Is a Distroless Image?A distroless image contains only your application and its runtime dependencies, with no shell, package manage…
What Is a Target Triple?A target triple is a string like x86_64-unknown-linux-gnu that identifies the architecture, vendor, OS, and A…