Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Libraries

Direct answer

Libraries are reusable code: static libraries (.a) built into programs and shared libraries (.so) loaded at runtime. Development packages add headers (-dev, -devel).

When to use this

Use it when a program needs a library at build or run time.

First 30 seconds

1. Missing at runtime: ldd <binary> | grep 'not found'.

2. Which package provides it: apt-file search <lib> / dnf provides '*/<lib>'.

3. Install the runtime (and -dev for builds).

4. Version mismatch → match the soname.

5. Re-run.

Operational verification

program linked against a library soname → library installed → loaded at runtime

Evidence · next step

For Software & Source → Libraries, continue with the first unproven Topic check: Identify the consuming artifact, required API/ABI and exact library candidates visible to the build. If that boundary is healthy, advance to the adjacent check: Capture compiler/linker search paths and the selected object/archive rather than only installed package names. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it when a program needs a library at build or run time.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

dependency requirement → header/API discovery → library candidate/version → compile symbols/types → link resolution → installed/runtime candidate → workload

Healthy evidence: the required API/ABI version is selected consistently at build and runtime and the consuming program resolves required symbols and passes its workload

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Identify the consuming artifact, required API/ABI and exact library candidates visible to the build.

  • Capture compiler/linker search paths and the selected object/archive rather than only installed package names.
  • Inspect runtime dependencies where the artifact uses dynamic linking.
  • Exercise functionality that depends on the library and verify the original workload.

Verification chain. dependency requirement → header/API discovery → library candidate/version → compile symbols/types → link resolution → installed/runtime candidate → workload

Step 3 Commands Verify boundary
ldconfig -p | grep ssl
dpkg -S libssl.so.3
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: headers and runtime library versions diverge, duplicate prefixes select another copy, ABI changes hide behind the same filename or static/shared choices differ from intent

Step 5 Common mistakes Narrow the fault
  • Copying libraries manually between systems.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

Runtime needs the .so; building needs headers too. Library versions follow sonames (libfoo.so.1) — an incompatible upgrade breaks programs linked to the old soname.

Key checks
  • git status / git log --oneline -5 — repository state
  • ldd <binary> — shared libraries
  • ldconfig -p | grep <lib> — libraries in the linker cache
  • make --version; gcc --version — build tools
ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

A library package/file being present does not show that the build or runtime selected the intended version or compatible ABI.

In depth

Libraries: static, shared and versioned

Most Linux programs use shared libraries, which are loaded at run time and shared between processes. ldconfig(8) maintains the system's view of them:

  • It creates the links for the newest versions of shared libraries.
  • It builds the cache /etc/ld.so.cache, from the directories in /etc/ld.so.conf and the trusted directories /lib and /usr/lib.
  • -p prints the cache.
  • Libraries follow a link chain such as libfoo.so → libfoo.so.1 → libfoo.so.1.12. The middle name is the SONAME.

Static and shared libraries

Static (.a)Shared (.so)
LinkedInto the program at build timeAt run time, by the dynamic linker
Security updatesEvery program must be rebuiltUpdate the library and restart the programs
Disk and memoryDuplicated in every programShared
DeploymentOne self-contained fileDependencies must be present
TypicalGo binaries, rescue toolsAlmost everything packaged

Library file names

FilePurposePackage (Debian example)
libssl.so.3SONAME link used at run timelibssl3
libssl.so.3.0.13, or an equivalent real fileThe actual librarylibssl3
libssl.soDevelopment link used when compilinglibssl-dev
libssl.aStatic librarylibssl-dev (sometimes)

Library updates need restarts

After a security update of a shared library, running programs keep the old version mapped in memory until they restart. Tools like needrestart (Debian and Ubuntu) and dnf needs-restarting (RHEL) find them. Under the hood, they look for mappings of deleted files in /proc/<pid>/maps.

host$ ldconfig -p | grep -E "libssl\.so|libcrypto\.so" | head -3
	libssl.so.3 (libc6,x86-64) => /lib/x86_64-linux-gnu/libssl.so.3
	libcrypto.so.3 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcrypto.so.3
host$ ls -l /lib/x86_64-linux-gnu/libssl.so*
lrwxrwxrwx 1 root root     13 Feb  4  2026 /lib/x86_64-linux-gnu/libssl.so -> libssl.so.3
-rw-r--r-- 1 root root 667864 Feb  4  2026 /lib/x86_64-linux-gnu/libssl.so.3
host$ readelf -d /lib/x86_64-linux-gnu/libssl.so.3 | grep SONAME
 0x000000000000000e (SONAME)             Library soname: [libssl.so.3]
host$ sudo grep -l "libssl.so.3 (deleted)" /proc/*/maps 2>/dev/null | cut -d/ -f3 | xargs -r ps -o pid,comm -p
    PID COMMAND
   1203 nginx
host$ file /usr/local/bin/tool

Reading the last search

nginx still maps the deleted old copy of libssl, so it's running the vulnerable version despite the update. Restarting nginx loads the new library. This is the check that matters after OpenSSL and glibc updates.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Libraries is part of Software & Source → Libraries. Libraries covers reusable code dependencies consumed during Linux build or runtime, including development headers, static archives, shared objects, ABI/API compatibility and version selection.

Topic-specific state model. Libraries covers reusable code dependencies consumed during Linux build or runtime, including development headers, static archives, shared objects, ABI/API compatibility and version selection.

Interpretation rule. - Library file present ≠ selected by build/runtime.

  • Header compiles ≠ ABI-compatible runtime library.
  • Link succeeds ≠ runtime loader selects same dependency.
  • Version string ≠ required symbols/behavior verified.

Quick reference

Libraries: static (.a, linked into the binary at build time) and shared (.so, loaded at runtime and shared between programs). Shared libraries get security fixes through package updates without rebuilding applications.

ldd /usr/bin/curl
rpm -qf /usr/lib64/libssl.so.3; dpkg -S libssl.so.3
objdump -p /usr/bin/curl | grep NEEDED

After updating a library, running processes still use the old version until restarted: needs-restarting -s (RHEL) or needrestart (Debian/Ubuntu) list them.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. A library package/file being present does not show that the build or runtime selected the intended version or compatible ABI.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. Libraries owns general dependency and compatibility concepts; Shared Libraries owns ELF dynamic-loader behavior in more detail and Package Management owns packaged dependency transactions.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Software & Source → Libraries. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://git-scm.com/docs · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux librariesdevelopment libraries linuxlibrary dependency linux
Embedded reference data

Quick lookup tables

Libraries operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Libraries.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateLibraries covers reusable code dependencies consumed during Linux build or runtime, including development headers, static archives, shared objects, ABI/API compatibility and version selection.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin exact source/revision or recovery point → verify inputs/consistency → observe copy/build/link result → read back destination/artifact and metadata/dependencies → restore/run in intended environment → repeat original workload + regression check.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chaindependency requirement → header/API discovery → library candidate/version → compile symbols/types → link resolution → installed/runtime candidate → workloadTrace requested/configured state through effective state to the observed workload result.
Failure boundaryA library package/file being present does not prove that the build or runtime selected the intended version or compatible ABI.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux backup/source evidence can establish this proof path: dependency requirement → header/API discovery → library candidate/version → compile symbols/types → link resolution → installed/runtime candidate → workloadUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove unobserved data, metadata, revisions, dependencies, consumers or time periods. A library package/file being present does not prove that the build or runtime selected the intended version or compatible ABI.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven backup/source/build boundary, capture adjacent identity/read-back/runtime evidence, make only the demonstrated persistent change, then repeat the original workload plus a regression check.Continue to the next unresolved boundary while preserving the original test condition.

Libraries · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryLibraries
Topic pathSoftware & Source → Libraries
Runtime stateLibraries covers reusable code dependencies consumed during Linux build or runtime, including development headers, static archives, shared objects, ABI/API compatibility and version selection.
Fast checks- Identify the consuming artifact, required API/ABI and exact library candidates visible to the build. - Capture compiler/linker search paths and the selected object/archive rather than only installed package names. - Inspect runtime dependencies where the artifact uses dynamic linking. - Exercise functionality that depends on the library and verify the original workload.
Verification chaindependency requirement → header/API discovery → library candidate/version → compile symbols/types → link resolution → installed/runtime candidate → workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary.
Failure boundaryA library package/file being present does not prove that the build or runtime selected the intended version or compatible ABI. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?