REVDEP

reverse dependency checker

Synopsis

revdep [ -r ] [ -i pkg,... ] [ -v ] [ package ... ]

Description

revdep scans installed packages to detect broken shared library dependencies. It opens every ELF binary and shared library owned by a package, reads the DT_NEEDED entries, and attempts to resolve each required library using the same search order as the dynamic linker. With no arguments, all installed packages are checked. If one or more

package

names are given, only those packages are checked.

Reverse mode

With -r, revdep operates in reverse: instead of checking

whether

a package's libraries are satisfied, it reports

which other packages

depend on the shared libraries provided by the named packages. This is the primary use case after updating a library. For example, after updating mesa-amdgpu, running:
revdep -r mesa-amdgpu
lists every package that links against mesa-amdgpu's shared libraries and may need to be rebuilt.

Options

-r
Reverse mode. Requires at least one __IBLOCK__package argument.
-i pkg,...
Comma-separated list of packages to ignore during checks.
-v
Increase verbosity. May be specified up to four times.
-h
Print usage summary and exit.

Verbosity

(none)
Print only the names of broken packages, one per line. Suitable for scripting.
-v
Formatted listing with status for each package checked.
-vv
Include the paths of broken files. In reverse mode, show which files trigger the dependency.
-vvv
Include precise error detail: which library is missing from which file.
-vvvv
Debug trace.

Library Search Order

revdep follows the dynamic linker search order for musl: 1. DT_RPATH (only if DT_RUNPATH is absent)
2. DT_RUNPATH
3. System directories: /lib, /usr/lib
4. Per-package directories from /etc/revdep.d/ The tokens $ORIGIN and $LIB are expanded in DT_RPATH and DT_RUNPATH entries. $ORIGIN resolves to the directory containing the ELF file. $LIB resolves to lib .

Exit Status

0
All checked packages have satisfied dependencies.
1
One or more packages have broken dependencies, or an error occurred.

Files

__IBLOCK__/var/lib/pkg/db
Package database. Each entry consists of the package name, version, and file list, separated by blank lines.
__IBLOCK__/etc/revdep.d/
Per-package configuration directory. A file named after a package may contain additional library search paths, one per line. Lines beginning with # are comments.

Examples

Check all installed packages:
revdep
Check specific packages with verbose output:
revdep -vv firefox chromium
After updating mesa, find what needs rebuilding:
revdep -r mesa-amdgpu
After updating wlroots and wayland, find all dependants:
revdep -r wlroots wayland
Full system check, ignoring kernel and firmware:
revdep -i linux,linux-firmware
Script a rebuild of all broken packages:
for p in $(revdep); do
cd /ports/core/$p || cd /usr/ports/*/$p
mkpkg -d -is
done

Notes

revdep uses a hash-table cache for ELF lookups. The same shared library referenced by hundreds of packages is parsed only once. Only x86_64 ELF files are inspected. Non-ELF files and files for other architectures are silently skipped. musl does not use /etc/ld.so.conf . Library resolution relies on DT_RUNPATH, the default system directories, and per-package configuration in /etc/revdep.d/ .

See Also

mkpkg(8), pkg.add(8), pkg.info(8), tux(8), ldd (1), readelf (1)

Pure LLVM musl libc Source-Based Independent