Shared Libraries: Direct Deps, the ldd Closure & the Linker Cache
MediumLinux+ Exam Prep15-25 minA dynamically-linked program doesn't carry its libraries — it finds them at run time. Three tools tell the story: readelf/objdump show the libraries a binary DECLARES (its DT_NEEDED entries), ldd shows the FULL set the loader actually resolves (direct deps plus every transitive dep), and ldconfig -p shows where the linker cache resolves a library on disk.
Audit the target binary named in /root/case/brief.txt and record three answers, each as a single value in its own file under /root/case/: its direct-dependency count (needed_count.txt); its full resolved-library count (resolved_count.txt) — every library ldd shows resolved to a path with =>, direct plus transitive (lines with no =>, such as the vDSO, don't count); and the absolute path the linker cache resolves the library named in the brief to (lib_path.txt). Grading re-derives every answer from the live system.
- Count a binary's declared DT_NEEDED direct dependencies with readelf/objdump
- Count the full transitive set the loader resolves with ldd
- See that the transitive closure is larger than the declared direct deps
- Resolve a library to its on-disk path via the ldconfig cache
Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.
