LIBCHK(1)               FreeBSD General Commands Manual              LIBCHK(1)

NAME
     libchk — checks shared library links of binaries

SYNOPSIS
     libchk [-hsv] [-x directory] [directory ...]

DESCRIPTION
     libchk is a tool to help users obtain the following information:
           -   A list of executables that have unresolvable shared library
               links
           -   A list of shared libraries that are not referenced by any
               binary
           -   A list of binaries for each shared library that are linked with
               the library

     Directories that libchk searches for executables and libraries include:
           /bin
           /sbin
           /usr/bin
           /usr/games
           /usr/libexec
           /usr/sbin
           $LOCALBASE/bin
           $LOCALBASE/libexec
           $LOCALBASE/sbin
           $X11BASE/bin
           $X11BASE/libexec
           $X11BASE/sbin

     And the directories listed in PATH and the library search path that
     ldconfig(8) tells.  In addition, a user can specify additional directo‐
     ries to search via the command line.

     e.g.:
           $ libchk /home/*/bin

     The directory list is automatically optimized to avoid duplicated search.

     libchk recursively looks into those directories and checks shared library
     links for each binary.  If a dead library link is found, it is immedi‐
     ately reported.

     When it is done though all directories, libchk lists the shared libraries
     in the library search path that are not referenced by (linked with) any
     binary.

WARNING
     Do not blindly delete libraries that libchk reports as unreferenced,
     because there are many reasons that libchk cannot perfectly detect if a
     shared library is referenced by:

           -   A library may be referenced by an executable hidden under a
               user directory or an application specific directory.

           -   A library may be put there for future use.

           -   A library on an NFS exported or NFS mounted file system may be
               referenced by an executable on another host.

           -   A library can be dynamically linked with by calling dlopen(3),
               which libchk can never detect.

OPTIONS
     The following command line arguments are supported:

     -s
     --strict   By default, libchk does not regard a reference to a library in
                the same directory as dead, but this option makes libchk warn
                of that as well.

     -v
     --verbose  Make a detailed report.  libchk will also check and report
                what executables and libraries each library is referenced
                (used) by.

     -x directory
     --exclude directory
                Exclude the specified directory from the list of directories
                that libchk searches for executables and libraries.
     directory ...
                Additional directories to search for binaries.

ENVIRONMENT
     PATH       The command search path.
     LOCALBASE  The local base directory. (default: /usr/local)
     X11BASE    The X11 base directory. (default: /usr/X11R6)

SEE ALSO
     ldconfig(8)

BUGS
     -   Currently, libchk only checks FreeBSD ELF executables and libraries.

AUTHORS
     Akinori MUSHA <knu@iDaemons.org>

FreeBSD                        September 2, 2002                       FreeBSD