Skip to content
Latchkey

ldd Command: Check Shared Libraries in CI

ldd lists the shared libraries a dynamically linked binary depends on.

ldd reports which shared objects (.so) a binary needs and whether the dynamic loader can find them. In CI it is the go-to diagnostic for "library not found" runtime failures, especially when copying a binary into a slim container image.

Common flags

  • ldd ./binary - list dependencies and their resolved paths
  • -v - verbose; include symbol versioning information
  • -u - report unused direct dependencies
  • -d - perform relocations and report missing objects
  • -r - perform relocations for both data objects and functions

Example in CI

Verify a built binary has all its shared libraries before packaging it:

shell
ldd ./app && echo "all libraries resolved"

Common errors in CI

  • libfoo.so.1 => not found - the required library is missing on the runner/image
  • not a dynamic executable - the binary is static (nothing for ldd to resolve)
  • version `GLIBC_2.34' not found - built against a newer glibc than the runtime

Key takeaways

  • "=> not found" pinpoints exactly which .so to install in the image.
  • A static binary reports "not a dynamic executable" - that is expected.
  • Run ldd in the target image, not the build image, to catch missing libs early.

Related guides

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