1 # dpkg manual page - dpkg-deb(1)
3 # Copyright © 1995-1996 Ian Jackson <ijackson@chiark.greenend.org.uk>
4 # Copyright © 2000 Wichert Akkerman <wakkerma@debian.org>
5 # Copyright © 2006 Frank Lichtenheld <djpig@debian.org>
6 # Copyright © 2007-2011 Raphaël Hertzog <hertzog@debian.org>
7 # Copyright © 2011-2013, 2015 Guillem Jover <guillem@debian.org>
9 # This is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
26 dpkg-shlibdeps - generate shared library substvar dependencies
31 [I<option>...] [B<-e>] I<executable> [I<option>...]
36 calculates shared library dependencies for executables named in its
38 The dependencies are added to the substitution
42 B<shlibs:>I<dependency-field>
45 is a dependency field name.
46 Any other variables starting with
48 are removed from the file.
51 has two possible sources of information to generate dependency
60 analyzes, it finds out the list of libraries that it's linked with.
61 Then, for each library, it looks up either the
65 file (if the former doesn't exist or if debian/shlibs.local contains
66 the relevant dependency).
67 Both files are supposed to be provided
68 by the library package and should thus be available as
69 %ADMINDIR%/info/I<package>.I<symbols>
70 or %ADMINDIR%/info/I<package>.I<shlibs>.
72 identified in two steps: find the library file on the system (looking in
73 the same directories that B<ld.so> would use), then use
74 B<dpkg -S> I<library-file>
75 to lookup the package providing the library.
79 Symbols files contain finer-grained dependency information by providing
80 the minimum dependency for each symbol that the library exports.
82 script tries to find a symbols file associated to a library package
83 in the following places (first match is used):
87 =item debian/*/DEBIAN/symbols
89 Shared library information generated by the current build process that also invoked
92 L<dpkg-gensymbols(1)>.
93 They are only used if the library is found in a package's build tree.
95 symbols file in that build tree takes precedence over symbols files from
96 other binary packages.
98 =item %PKGCONFDIR%/symbols/I<package>.symbols.I<arch>
100 =item %PKGCONFDIR%/symbols/I<package>.symbols
102 Per-system overriding shared library dependency information.
103 I<arch> is the architecture of the current system (obtained by
104 B<dpkg-architecture -qDEB_HOST_ARCH>).
106 =item Output from “B<dpkg-query --control-path> I<package> symbols”
108 Package-provided shared library dependency information.
109 Unless overridden by B<--admindir>, those files are located in
114 While scanning the symbols used by all binaries,
116 remembers the (biggest) minimal version needed for each library.
118 of the process, it is able to write out the minimal dependency for every
119 library used (provided that the information of the I<symbols> files are
122 As a safe-guard measure, a symbols file can provide a
123 B<Build-Depends-Package> or B<Build-Depends-Packages> meta-information
124 field and B<dpkg-shlibdeps>
125 will extract the minimal version required by the corresponding package in
126 the B<Build-Depends> field and use this version if it's higher than the
127 minimal version computed by scanning symbols.
131 Shlibs files associate directly a library to a dependency (without looking
133 It's thus often stronger than really needed but very safe
136 The dependencies for a library are looked up in several places.
138 file providing information for the library of interest is used:
142 =item debian/shlibs.local
144 Package-local overriding shared library dependency information.
146 =item %PKGCONFDIR%/shlibs.override
148 Per-system overriding shared library dependency information.
150 =item debian/*/DEBIAN/shlibs
152 Shared library information generated by the current build process that also invoked
154 They are only used if the library is found in a package's build tree.
156 shlibs file in that build tree takes precedence over shlibs files from
157 other binary packages.
159 =item Output from “B<dpkg-query --control-path> I<package> shlibs”
161 Package-provided shared library dependency information.
162 Unless overridden by B<--admindir>, those files are located in
165 =item %PKGCONFDIR%/shlibs.default
167 Per-system default shared library dependency information.
171 The extracted dependencies are then directly used (except if they are
172 filtered out because they have been identified as duplicate, or as weaker
173 than another dependency).
178 interprets non-option arguments as executable names, just as if they'd
184 =item B<-e>I<executable>
186 Include dependencies appropriate for the shared libraries required by
188 This option can be used multiple times.
190 =item B<-l>I<directory>
194 to the list of directories to search for private shared libraries
196 This option can be used multiple times.
198 B<Note>: Use this option instead of setting B<LD_LIBRARY_PATH>,
199 as that environment variable is used to control the run-time linker
200 and abusing it to set the shared library paths at build-time can be
201 problematic when cross-compiling for example.
203 =item B<-d>I<dependency-field>
205 Add dependencies to be added to the control file dependency field
207 (The dependencies for this field are placed in the variable
208 B<shlibs:>I<dependency-field>.)
211 B<-d>I<dependency-field>
212 option takes effect for all executables after the option, until the
214 B<-d>I<dependency-field>.
220 If the same dependency entry (or set of alternatives) appears in more
221 than one of the recognized dependency field names
222 B<Pre-Depends>, B<Depends>, B<Recommends>, B<Enhances> or B<Suggests>
225 will automatically remove the dependency from all fields except the
226 one representing the most important dependencies.
228 =item B<--package=>I<package>
230 Define the package name.
233 the package name will be used to change defaults based on the
234 binary package metadata in F<debian/control>.
236 If the package is B<Essential: yes>,
237 then the default dependency field is B<Pre-Depends>, otherwise B<Depends>.
238 The default package type is set from the B<Package-Type> field.
239 The package is added to the set of packages excluded by B<-x>.
241 Option supported since dpkg 1.22.7.
243 =item B<-p>I<varname-prefix>
245 Start substitution variables with
246 I<varname-prefix>B<:>
249 Likewise, any existing substitution variables starting with
250 I<varname-prefix>B<:>
253 are removed from the substitution variables file.
255 =item B<-O>[I<filename>]
257 Print substitution variable settings to standard output (or I<filename>
258 if specified, since dpkg 1.17.2), rather than being added to the
259 substitution variables file
265 Prefer shared library dependency information tagged for the given
267 If no tagged information is available, falls back to untagged information.
268 The default package type is B<deb>.
269 Shared library dependency
270 information is tagged for a given type by prefixing it with the name of the
271 type, a colon, and whitespace.
273 =item B<-L>I<local-shlibs-file>
275 Read overriding shared library dependency information from
278 B<debian/shlibs.local>.
280 =item B<-T>I<substvars-file>
282 Write substitution variables in
289 Enable verbose mode (since dpkg 1.14.8).
290 Numerous messages are displayed to explain what
294 =item B<-x>I<package>
296 Exclude the package from the generated dependencies (since dpkg 1.14.8).
298 avoid self-dependencies for packages which provide ELF binaries
299 (executables or library plugins) using a library contained in the same
301 This option can be used multiple times to exclude several
304 =item B<-S>I<package-build-dir>
306 Look into I<package-build-dir> first when trying to find a library
307 (since dpkg 1.14.15).
309 useful when the source package builds multiple flavors of the same library
310 and you want to ensure that you get the dependency from a given binary
312 You can use this option multiple times: directories will be
313 tried in the same order before directories of other binary packages.
315 =item B<-I>I<package-build-dir>
317 Ignore I<package-build-dir> when looking for shlibs, symbols, and shared
318 library files (since dpkg 1.18.5).
319 You can use this option multiple times.
321 =item B<--ignore-missing-info>
323 Do not fail if dependency information can't be found for a shared library
325 Usage of this option is discouraged, all libraries should provide
326 dependency information (either with shlibs files, or with symbols files)
327 even if they are not yet used by other packages.
329 =item B<--warnings=>[I<value>|I<string>[,...]]
331 Select the set of warnings that can be emitted by B<dpkg-shlibdeps>
332 (since dpkg 1.14.17).
334 The warnings can be selected from a comma-separated list of symbolic
335 names (since dpkg 1.22.12),
336 or from a I<value> denoting a bit field for these warnings.
340 =item symbol-not-found (bit 0, value 1)
342 Selects the warning “symbol I<sym> used by I<binary> found in none of the
347 =item avoidable-dependency (bit 1, value 2)
349 Selects the warning “package could avoid a useless dependency”.
353 =item useless-linkage (bit 2, value 4)
355 Select the warning “I<binary> should not be linked against I<library>”.
359 =item B<--admindir=>I<dir>
361 Change the location of the B<dpkg> database (since dpkg 1.14.0).
362 The default location is I<%ADMINDIR%>.
364 =item B<-?>, B<--help>
366 Show the usage message and exit.
370 Show the version and exit.
378 =item B<DEB_HOST_ARCH>
380 Sets the host architecture.
381 This affects the objects and symbols files searched for and
382 their default search pathnames.
386 Sets the color mode (since dpkg 1.18.5).
387 The currently accepted values are: B<auto> (default), B<always> and
392 If set, it will be used to decide whether to activate Native Language Support,
393 also known as internationalization (or i18n) support (since dpkg 1.19.0).
394 The accepted values are: B<0> and B<1> (default).
404 analyzes the set of symbols used by each binary of the generated package,
405 it is able to emit warnings in several cases.
406 They inform you of things that can be improved in the package.
407 In most cases, those improvements concern the upstream sources directly.
408 By order of decreasing importance,
409 here are the various warnings that you can encounter:
413 =item B<symbol> I<sym> B<used by> I<binary> B<found in none of the libraries.>
415 The indicated symbol has not been found in the libraries linked with the
417 The I<binary> is most likely a library and it needs to be linked
418 with an additional library during the build process (option
419 B<-l>I<library> of the linker).
421 =item I<binary> B<contains an unresolvable reference to symbol> I<sym>B<: it's probably a plugin>
423 The indicated symbol has not been found in the libraries linked with the
425 The I<binary> is most likely a plugin and the symbol is probably provided
426 by the program that loads this plugin.
428 plugin doesn't have any SONAME but this binary does have one and as such
429 it could not be clearly identified as such.
430 However the fact that the
431 binary is stored in a non-public directory is a strong indication
432 that's it's not a normal shared library.
433 If the binary is really a plugin, then disregard this warning.
434 But there's always the possibility
435 that it's a real library and that programs linking to it are using an
436 RPATH so that the dynamic loader finds it.
437 In that case, the library is
438 broken and needs to be fixed.
440 =item B<package could avoid a useless dependency if> I<binary> B<was not linked against> I<library> B<(it uses none of the library's symbols)>
442 None of the I<binaries> that are linked with I<library> use any of the
443 symbols provided by the library.
444 By fixing all the binaries, you would avoid
445 the dependency associated to this library (unless the same dependency is
446 also generated by another library that is really used).
448 =item B<package could avoid a useless dependency if> I<binaries> B<were not linked against> I<library> B<(they use none of the library's symbols)>
450 Exactly the same as the above warning, but for multiple binaries.
452 =item I<binary> B<should not be linked against> I<library> B<(it uses none of the library's symbols)>
454 The I<binary> is linked to a library that it doesn't need.
456 problem but some small performance improvements in binary load time can be
457 obtained by not linking this library to this binary.
459 the same information as the previous one but does it for each binary
460 instead of doing the check globally on all binaries analyzed.
467 will fail if it can't find a public library used by a binary or if this
468 library has no associated dependency information (either shlibs file or
470 A public library has a SONAME and is versioned (libsomething.so.I<X>).
471 A private library (like a plugin) should not
472 have a SONAME and doesn't need to be versioned.
476 =item B<couldn't find library> I<library-soname> B<needed by> I<binary> B<(its RPATH is '>I<rpath>B<')>
478 The I<binary> uses a library called I<library-soname> but
480 has been unable to find the library.
482 creates a list of directories to check as following: directories listed in
483 the RPATH of the binary, directories added by the B<-l> option, directories
484 listed in the B<LD_LIBRARY_PATH> environment variable, cross multiarch
485 directories (ex. /lib/arm64-linux-gnu, /usr/lib/arm64-linux-gnu), standard
486 public directories (/lib, /usr/lib), directories listed in /etc/ld.so.conf,
487 and obsolete multilib directories (/lib32, /usr/lib32, /lib64, /usr/lib64).
488 Then it checks those directories in the package's build tree
489 of the binary being analyzed, in the packages' build trees indicated with
490 the B<-S> command-line option, in other packages' build trees that contains
491 a DEBIAN/shlibs or DEBIAN/symbols file and finally in the root directory.
492 If the library is not found in any of those directories, then you get this
495 If the library not found is in a private directory of the same package,
496 then you want to add the directory with B<-l>.
498 binary package being built, you want to make sure that the shlibs/symbols
499 file of this package is already created and that B<-l>
500 contains the appropriate directory if it also is in a private directory.
502 =item B<no dependency information found for> I<library-file> B<(used by> I<binary>B<).>
504 The library needed by I<binary> has been found by
506 in I<library-file> but
508 has been unable to find any dependency information for that library.
510 find out the dependency, it has tried to map the library to a Debian
511 package with the help of
512 B<dpkg -S> I<library-file>.
513 Then it checked the corresponding shlibs and symbols files in
514 %ADMINDIR%/info/, and in the various package's build trees
517 This failure can be caused by a bad or missing shlibs or symbols file
518 in the package of the library.
519 It might also happen if the library is
520 built within the same source package and if the shlibs files has not yet
521 been created (in which case you must fix debian/rules to create
522 the shlibs before calling B<dpkg-shlibdeps>).
524 lead to the library being found under a non-canonical name (example:
525 /usr/lib/openoffice.org/../lib/libssl.so.0.9.8 instead of
526 /usr/lib/libssl.so.0.9.8) that's not associated to any package,
528 tries to work around this by trying to fallback on a canonical name (using
530 but it might not always work.
531 It's always best to clean up the RPATH
532 of the binary to avoid problems.
536 in verbose mode (B<-v>) will provide much more information about where it
537 tried to find the dependency information.
538 This might be useful if you
539 don't understand why it's giving you this error.
548 L<dpkg-gensymbols(1)>.