1dpkg-gensymbols(1) dpkg suite dpkg-gensymbols(1)
2
3
4
6 dpkg-gensymbols - generate symbols files (shared library dependency
7 information)
8
10 dpkg-gensymbols [option...]
11
13 dpkg-gensymbols scans a temporary build tree (debian/tmp by default)
14 looking for libraries and generates a symbols file describing them.
15 This file, if non-empty, is then installed in the DEBIAN subdirectory
16 of the build tree so that it ends up included in the control
17 information of the package.
18
19 When generating those files, it uses as input some symbols files
20 provided by the maintainer. It looks for the following files (and uses
21 the first that is found):
22
23 • debian/package.symbols.arch
24
25 • debian/symbols.arch
26
27 • debian/package.symbols
28
29 • debian/symbols
30
31 The main interest of those files is to provide the minimal version
32 associated to each symbol provided by the libraries. Usually it
33 corresponds to the first version of that package that provided the
34 symbol, but it can be manually incremented by the maintainer if the ABI
35 of the symbol is extended without breaking backwards compatibility.
36 It's the responsibility of the maintainer to keep those files up-to-
37 date and accurate, but dpkg-gensymbols helps with that.
38
39 When the generated symbols files differ from the maintainer supplied
40 one, dpkg-gensymbols will print a diff between the two versions.
41 Furthermore if the difference is too significant, it will even fail
42 (you can customize how much difference you can tolerate, see the -c
43 option).
44
46 The base interchange format of the symbols file is described in deb-
47 symbols(5), which is used by the symbols files included in binary
48 packages. These are generated from template symbols files with a format
49 based on the former, described in deb-src-symbols(5) and included in
50 source packages.
51
52 The symbols files are really useful only if they reflect the evolution
53 of the package through several releases. Thus the maintainer has to
54 update them every time that a new symbol is added so that its
55 associated minimal version matches reality.
56
57 The diffs contained in the build logs can be used as a starting point,
58 but the maintainer, additionally, has to make sure that the behaviour
59 of those symbols has not changed in a way that would make anything
60 using those symbols and linking against the new version, stop working
61 with the old version.
62
63 In most cases, the diff applies directly to the debian/package.symbols
64 file. That said, further tweaks are usually needed: it's recommended
65 for example to drop the Debian revision from the minimal version so
66 that backports with a lower version number but the same upstream
67 version still satisfy the generated dependencies. If the Debian
68 revision can't be dropped because the symbol really got added by the
69 Debian specific change, then one should suffix the version with ‘~’.
70
71 Before applying any patch to the symbols file, the maintainer should
72 double-check that it's sane. Public symbols are not supposed to
73 disappear, so the patch should ideally only add new lines.
74
75 Note that you can put comments in symbols files.
76
77 Do not forget to check if old symbol versions need to be increased.
78 There is no way dpkg-gensymbols can warn about this. Blindly applying
79 the diff or assuming there is nothing to change if there is no diff,
80 without checking for such changes, can lead to packages with loose
81 dependencies that claim they can work with older packages they cannot
82 work with. This will introduce hard to find bugs with (partial)
83 upgrades.
84
85 Good library management
86 A well-maintained library has the following features:
87
88 • its API is stable (public symbols are never dropped, only new
89 public symbols are added) and changes in incompatible ways only
90 when the SONAME changes;
91
92 • ideally, it uses symbol versioning to achieve ABI stability despite
93 internal changes and API extension;
94
95 • it doesn't export private symbols (such symbols can be tagged
96 optional as workaround).
97
98 While maintaining the symbols file, it's easy to notice appearance and
99 disappearance of symbols. But it's more difficult to catch incompatible
100 API and ABI change. Thus the maintainer should read thoroughly the
101 upstream changelog looking for cases where the rules of good library
102 management have been broken. If potential problems are discovered, the
103 upstream author should be notified as an upstream fix is always better
104 than a Debian specific work-around.
105
107 -Ppackage-build-dir
108 Scan package-build-dir instead of debian/tmp.
109
110 -ppackage
111 Define the package name. Required if more than one binary package
112 is listed in debian/control (or if there's no debian/control file).
113
114 -vversion
115 Define the package version. Defaults to the version extracted from
116 debian/changelog. Required if called outside of a source package
117 tree.
118
119 -elibrary-file
120 Only analyze libraries explicitly listed instead of finding all
121 public libraries. You can use shell patterns used for pathname
122 expansions (see the File::Glob(3perl) manual page for details) in
123 library-file to match multiple libraries with a single argument
124 (otherwise you need multiple -e).
125
126 -ldirectory
127 Prepend directory to the list of directories to search for private
128 shared libraries (since dpkg 1.19.1). This option can be used
129 multiple times.
130
131 Note: Use this option instead of setting LD_LIBRARY_PATH, as that
132 environment variable is used to control the run-time linker and
133 abusing it to set the shared library paths at build-time can be
134 problematic when cross-compiling for example.
135
136 -Ifilename
137 Use filename as reference file to generate the symbols file that is
138 integrated in the package itself.
139
140 -O[filename]
141 Print the generated symbols file to standard output or to filename
142 if specified, rather than to debian/tmp/DEBIAN/symbols (or package-
143 build-dir/DEBIAN/symbols if -P was used). If filename is pre-
144 existing, its contents are used as basis for the generated symbols
145 file. You can use this feature to update a symbols file so that it
146 matches a newer upstream version of your library.
147
148 -t Write the symbol file in template mode rather than the format
149 compatible with deb-symbols(5). The main difference is that in the
150 template mode symbol names and tags are written in their original
151 form contrary to the post-processed symbol names with tags stripped
152 in the compatibility mode. Moreover, some symbols might be omitted
153 when writing a standard deb-symbols(5) file (according to the tag
154 processing rules) while all symbols are always written to the
155 symbol file template.
156
157 -c[0-4]
158 Define the checks to do when comparing the generated symbols file
159 with the template file used as starting point. By default the level
160 is 1. Increasing levels do more checks and include all checks of
161 lower levels.
162
163 Level 0
164 Never fails.
165
166 Level 1
167 Fails if some symbols have disappeared.
168
169 Level 2
170 Fails if some new symbols have been introduced.
171
172 Level 3
173 Fails if some libraries have disappeared.
174
175 Level 4
176 Fails if some libraries have been introduced.
177
178 This value can be overridden by the environment variable
179 DPKG_GENSYMBOLS_CHECK_LEVEL.
180
181 -q Keep quiet and never generate a diff between generated symbols file
182 and the template file used as starting point or show any warnings
183 about new/lost libraries or new/lost symbols. This option only
184 disables informational output but not the checks themselves (see -c
185 option).
186
187 -aarch
188 Assume arch as host architecture when processing symbol files. Use
189 this option to generate a symbol file or diff for any architecture
190 provided its binaries are already available.
191
192 -d Enable debug mode. Numerous messages are displayed to explain what
193 dpkg-gensymbols does.
194
195 -V Enable verbose mode. The generated symbols file contains deprecated
196 symbols as comments. Furthermore in template mode, pattern symbols
197 are followed by comments listing real symbols that have matched the
198 pattern.
199
200 -?, --help
201 Show the usage message and exit.
202
203 --version
204 Show the version and exit.
205
207 DPKG_GENSYMBOLS_CHECK_LEVEL
208 Overrides the command check level, even if the -c command-line
209 argument was given (note that this goes against the common
210 convention of command-line arguments having precedence over
211 environment variables).
212
213 DPKG_COLORS
214 Sets the color mode (since dpkg 1.18.5). The currently accepted
215 values are: auto (default), always and never.
216
217 DPKG_NLS
218 If set, it will be used to decide whether to activate Native
219 Language Support, also known as internationalization (or i18n)
220 support (since dpkg 1.19.0). The accepted values are: 0 and 1
221 (default).
222
224 <https://people.redhat.com/drepper/symbol-versioning>,
225 <https://people.redhat.com/drepper/goodpractice.pdf>,
226 <https://people.redhat.com/drepper/dsohowto.pdf>, deb-src-symbol(5),
227 deb-symbols(5), dpkg-shlibdeps(1).
228
229
230
2311.21.21 2023-02-25 dpkg-gensymbols(1)