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
ld Command: The Linker in CIld is the GNU linker. Reference for -o, -l, -L, -shared, -rpath, --gc-sections, and the undefined-reference a…
gcc Command: Compile C in CIgcc is the GNU C compiler driver. Reference for -c, -o, -I, -L, -l, -Wall, -O2, -std, and the header/library…
clang Command: Compile C/C++ in CIclang is the LLVM C/C++ compiler. Reference for -c, -o, -I, -std, -fsanitize, -Weverything, and the diagnosti…