.\" $Id$ .\" .Dd September 2, 2002 .Dt LIBCHK 1 .Os FreeBSD .Sh NAME .Nm libchk .Nd checks shared library links of binaries .Sh SYNOPSIS .Nm .Op Fl hsv .Op Fl x Ar directory .Op Ar directory ... .Sh DESCRIPTION .Nm is a tool to help users obtain the following information: .Bl -dash -compact -offset indent .It A list of executables that have unresolvable shared library links .It A list of shared libraries that are not referenced by any binary .It A list of binaries for each shared library that are linked with the library .El .Pp Directories that .Nm searches for executables and libraries include: .Bl -column -compact -offset indent .It Pa /bin .It Pa /sbin .It Pa /usr/bin .It Pa /usr/games .It Pa /usr/libexec .It Pa /usr/sbin .It Pa $LOCALBASE/bin .It Pa $LOCALBASE/libexec .It Pa $LOCALBASE/sbin .It Pa $X11BASE/bin .It Pa $X11BASE/libexec .It Pa $X11BASE/sbin .El .Pp And the directories listed in .Ev PATH and the library search path that .Xr ldconfig 8 tells. In addition, a user can specify additional directories to search via the command line. .Pp e.g.: .Dl $ libchk /home/*/bin .Pp The directory list is automatically optimized to avoid duplicated search. .Pp .Nm recursively looks into those directories and checks shared library links for each binary. If a dead library link is found, it is immediately reported. .Pp When it is done though all directories, .Nm lists the shared libraries in the library search path that are not referenced by (linked with) any binary. .Pp .Sh WARNING Do not blindly delete libraries that .Nm reports as unreferenced, because there are many reasons that .Nm cannot perfectly detect if a shared library is referenced by: .Bl -dash -offset indent .It A library may be referenced by an executable hidden under a user directory or an application specific directory. .Pp .It A library may be put there for future use. .Pp .It A library on an NFS exported or NFS mounted file system may be referenced by an executable on another host. .Pp .It A library can be dynamically linked with by calling .Xr dlopen 3 , which .Nm can never detect. .El .Pp .Sh OPTIONS The following command line arguments are supported: .Pp .Bl -tag -width "--verbose" -compact .It Fl s .It Fl -strict By default, .Nm does not regard a reference to a library in the same directory as dead, but this option makes .Nm warn of that as well. .Pp .It Fl v .It Fl -verbose Make a detailed report. .Nm will also check and report what executables and libraries each library is referenced (used) by. .Pp .It Fl x Ar directory .It Fl -exclude Ar directory Exclude the specified directory from the list of directories that .Nm searches for executables and libraries. .It Ar directory ... Additional directories to search for binaries. .El .Sh ENVIRONMENT .Bl -tag -width "LOCALBASE" -compact .It Ev PATH The command search path. .It Ev LOCALBASE The local base directory. (default: .Pa /usr/local ) .It Ev X11BASE The X11 base directory. (default: .Pa /usr/X11R6 ) .El .Sh SEE ALSO .Xr ldconfig 8 .Sh BUGS .Bl -dash -compact .It Currently, .Nm only checks .Fx ELF executables and libraries. .El .Sh AUTHORS .An Akinori MUSHA Aq knu@iDaemons.org