[[symbols]]
=== Library symbols

The symbols support in the *dpkg* introduced to Debian *lenny* (5.0, May 2009) helps us to manage the backward ABI compatibility of the library package with the same package name.  The *DEBIAN/symbols* file in the binary package provides the minimal version associated to each symbol.

The oversimplified method for the library packaging is as follows.

* Extract the old *DEBIAN/symbols* file of the immediate previous binary package with the ``*dpkg-deb -e*'' command.
** Alternatively, the *mc* command may be used to extract the *DEBIAN/symbols* file.
* Copy it to the *debian/*'binarypackage'*.symbols* file.
** If this is the first package, use an empty content file instead.
* Build the binary package.
** If the *dpkg-gensymbols* command warns some new symbols:
*** Extract the updated *DEBIAN/symbols* file with the ``*dpkg-deb -e*'' command.
*** Trim the Debian revision such as *-1* in it.
*** Copy it to the *debian/*'binarypackage'*.symbols* file.
*** Re-build the binary package.
** If the *dpkg-gensymbols* command does not warn new symbols:
*** You are done with the library packaging.

For the details, you should read the following primary references.

* http://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-symbols[8.6.3 The symbols system] of the ``Debian Policy Manual''
* *dh_makeshlibs*(1)
* *dpkg-gensymbols*(1)
* *dpkg-shlibdeps*(1)
* *deb-symbols*(5)

Yous should also check:

* Debian wiki https://wiki.debian.org/UsingSymbolsFiles[UsingSymbolsFiles]
* Debian wiki https://wiki.debian.org/Projects/ImprovedDpkgShlibdeps[Projects/ImprovedDpkgShlibdeps]
* Debian kde team http://pkg-kde.alioth.debian.org/symbolfiles.html[Working with symbols files]
* <<autotools-multi>>
* <<cmake-multi>>

TIP: For C++ libraries and other cases where the tracking of the symbols is problematic, follow https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-shlibdeps[8.6.4 The shlibs system] of the ``Debian Policy Manual'', instead.  Please make sure to erase the empty *debian/*'binarypackage'*.symbols* file generated by the *debmake* command.  For this case, the *DEBIAN/shlibs* file is used.
