dh_makeshlibs - Linux


dh_makeshlibs is a command used in Debian packaging to generate shared libraries (.so) from static libraries (.a). It is used to prepare a Debian package for building and installing shared libraries, ensuring compatibility across different architectures and distributions.


dh_makeshlibs [OPTIONS] [FILES...]


  • -a, –all: Process all available libraries in the package.
  • -e, –exclude-regex=PATTERN: Exclude libraries matching the given regular expression from processing.
  • -p, –patterns=PATTERN: Only process libraries matching the given comma-separated pattern.
  • -i, –ignore-missing: Ignore missing files or dependencies and continue processing.
  • -P, –preserve: Preserve existing .so files during processing.
  • -V, –verbose: Print detailed messages about the processing.
  • –help: Display help information and exit.
  • –version: Display version information and exit.


Simple usage: Process all libraries in the package:


Exclude libraries: Ignore libraries whose names start with "libz":

dh_makeshlibs --exclude-regex="^libz"

Process specific libraries: Only process libraries matching the pattern "libfoo":

dh_makeshlibs --patterns="libfoo"

Preserve existing .so files:

dh_makeshlibs --preserve

Common Issues

  • Missing dependencies: Ensure that all necessary dependencies are installed before running dh_makeshlibs.
  • Incorrect patterns: Check that the specified patterns correctly match the desired libraries.
  • Failed compilation: If libraries fail to compile, verify that the necessary compilers and libraries are available.


dh_makeshlibs is typically used in a Debian package build process:

  1. Create a "debian/rules" file that calls dh_makeshlibs in the "override_dh_installinit" target.
  2. Add a "debian/shlibs" file to specify the shared libraries to be installed.
  3. Build the package using dpkg-buildpackage -us -uc.

Related Commands

  • dh_installinit: Prepares a Debian package for building and installing.
  • dh_installdeb: Builds a Debian package from a source package.
  • dh_missing: Checks for missing files or dependencies in a Debian package.