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> meta-information field and
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<-p>I<varname-prefix>
230 Start substitution variables with
231 I<varname-prefix>B<:>
234 Likewise, any existing substitution variables starting with
235 I<varname-prefix>B<:>
238 are removed from the substitution variables file.
240 =item B<-O>[I<filename>]
242 Print substitution variable settings to standard output (or I<filename>
243 if specified, since dpkg 1.17.2), rather than being added to the
244 substitution variables file
250 Prefer shared library dependency information tagged for the given
252 If no tagged information is available, falls back to untagged information.
253 The default package type is B<deb>.
254 Shared library dependency
255 information is tagged for a given type by prefixing it with the name of the
256 type, a colon, and whitespace.
258 =item B<-L>I<local-shlibs-file>
260 Read overriding shared library dependency information from
263 B<debian/shlibs.local>.
265 =item B<-T>I<substvars-file>
267 Write substitution variables in
274 Enable verbose mode (since dpkg 1.14.8).
275 Numerous messages are displayed to explain what
279 =item B<-x>I<package>
281 Exclude the package from the generated dependencies (since dpkg 1.14.8).
283 avoid self-dependencies for packages which provide ELF binaries
284 (executables or library plugins) using a library contained in the same
286 This option can be used multiple times to exclude several
289 =item B<-S>I<package-build-dir>
291 Look into I<package-build-dir> first when trying to find a library
292 (since dpkg 1.14.15).
294 useful when the source package builds multiple flavors of the same library
295 and you want to ensure that you get the dependency from a given binary
297 You can use this option multiple times: directories will be
298 tried in the same order before directories of other binary packages.
300 =item B<-I>I<package-build-dir>
302 Ignore I<package-build-dir> when looking for shlibs, symbols, and shared
303 library files (since dpkg 1.18.5).
304 You can use this option multiple times.
306 =item B<--ignore-missing-info>
308 Do not fail if dependency information can't be found for a shared library
310 Usage of this option is discouraged, all libraries should provide
311 dependency information (either with shlibs files, or with symbols files)
312 even if they are not yet used by other packages.
314 =item B<--warnings=>I<value>
316 I<value> is a bit field defining the set of warnings that
317 can be emitted by B<dpkg-shlibdeps> (since dpkg 1.14.17).
318 Bit 0 (value=1) enables the warning “symbol I<sym> used by I<binary>
319 found in none of the libraries”, bit 1 (value=2) enables the warning
320 “package could avoid a useless dependency” and bit 2 (value=4) enables
321 the warning “I<binary> should not be linked against I<library>”.
322 The default I<value> is 3: the first two warnings are active by
323 default, the last one is not.
324 Set I<value> to 7 if you want all
325 warnings to be active.
327 =item B<--admindir=>I<dir>
329 Change the location of the B<dpkg> database (since dpkg 1.14.0).
330 The default location is I<%ADMINDIR%>.
332 =item B<-?>, B<--help>
334 Show the usage message and exit.
338 Show the version and exit.
348 Sets the color mode (since dpkg 1.18.5).
349 The currently accepted values are: B<auto> (default), B<always> and
354 If set, it will be used to decide whether to activate Native Language Support,
355 also known as internationalization (or i18n) support (since dpkg 1.19.0).
356 The accepted values are: B<0> and B<1> (default).
366 analyzes the set of symbols used by each binary of the generated package,
367 it is able to emit warnings in several cases.
368 They inform you of things that can be improved in the package.
369 In most cases, those improvements concern the upstream sources directly.
370 By order of decreasing importance,
371 here are the various warnings that you can encounter:
375 =item B<symbol> I<sym> B<used by> I<binary> B<found in none of the libraries.>
377 The indicated symbol has not been found in the libraries linked with the
379 The I<binary> is most likely a library and it needs to be linked
380 with an additional library during the build process (option
381 B<-l>I<library> of the linker).
383 =item I<binary> B<contains an unresolvable reference to symbol> I<sym>B<: it's probably a plugin>
385 The indicated symbol has not been found in the libraries linked with the
387 The I<binary> is most likely a plugin and the symbol is probably provided
388 by the program that loads this plugin.
390 plugin doesn't have any SONAME but this binary does have one and as such
391 it could not be clearly identified as such.
392 However the fact that the
393 binary is stored in a non-public directory is a strong indication
394 that's it's not a normal shared library.
395 If the binary is really a plugin, then disregard this warning.
396 But there's always the possibility
397 that it's a real library and that programs linking to it are using an
398 RPATH so that the dynamic loader finds it.
399 In that case, the library is
400 broken and needs to be fixed.
402 =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)>
404 None of the I<binaries> that are linked with I<library> use any of the
405 symbols provided by the library.
406 By fixing all the binaries, you would avoid
407 the dependency associated to this library (unless the same dependency is
408 also generated by another library that is really used).
410 =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)>
412 Exactly the same as the above warning, but for multiple binaries.
414 =item I<binary> B<should not be linked against> I<library> B<(it uses none of the library's symbols)>
416 The I<binary> is linked to a library that it doesn't need.
418 problem but some small performance improvements in binary load time can be
419 obtained by not linking this library to this binary.
421 the same information as the previous one but does it for each binary
422 instead of doing the check globally on all binaries analyzed.
429 will fail if it can't find a public library used by a binary or if this
430 library has no associated dependency information (either shlibs file or
432 A public library has a SONAME and is versioned (libsomething.so.I<X>).
433 A private library (like a plugin) should not
434 have a SONAME and doesn't need to be versioned.
438 =item B<couldn't find library> I<library-soname> B<needed by> I<binary> B<(its RPATH is '>I<rpath>B<')>
440 The I<binary> uses a library called I<library-soname> but
442 has been unable to find the library.
444 creates a list of directories to check as following: directories listed in
445 the RPATH of the binary, directories added by the B<-l> option, directories
446 listed in the B<LD_LIBRARY_PATH> environment variable, cross multiarch
447 directories (ex. /lib/arm64-linux-gnu, /usr/lib/arm64-linux-gnu), standard
448 public directories (/lib, /usr/lib), directories listed in /etc/ld.so.conf,
449 and obsolete multilib directories (/lib32, /usr/lib32, /lib64, /usr/lib64).
450 Then it checks those directories in the package's build tree
451 of the binary being analyzed, in the packages' build trees indicated with
452 the B<-S> command-line option, in other packages' build trees that contains
453 a DEBIAN/shlibs or DEBIAN/symbols file and finally in the root directory.
454 If the library is not found in any of those directories, then you get this
457 If the library not found is in a private directory of the same package,
458 then you want to add the directory with B<-l>.
460 binary package being built, you want to make sure that the shlibs/symbols
461 file of this package is already created and that B<-l>
462 contains the appropriate directory if it also is in a private directory.
464 =item B<no dependency information found for> I<library-file> B<(used by> I<binary>B<).>
466 The library needed by I<binary> has been found by
468 in I<library-file> but
470 has been unable to find any dependency information for that library.
472 find out the dependency, it has tried to map the library to a Debian
473 package with the help of
474 B<dpkg -S> I<library-file>.
475 Then it checked the corresponding shlibs and symbols files in
476 %ADMINDIR%/info/, and in the various package's build trees
479 This failure can be caused by a bad or missing shlibs or symbols file
480 in the package of the library.
481 It might also happen if the library is
482 built within the same source package and if the shlibs files has not yet
483 been created (in which case you must fix debian/rules to create
484 the shlibs before calling B<dpkg-shlibdeps>).
486 lead to the library being found under a non-canonical name (example:
487 /usr/lib/openoffice.org/../lib/libssl.so.0.9.8 instead of
488 /usr/lib/libssl.so.0.9.8) that's not associated to any package,
490 tries to work around this by trying to fallback on a canonical name (using
492 but it might not always work.
493 It's always best to clean up the RPATH
494 of the binary to avoid problems.
498 in verbose mode (B<-v>) will provide much more information about where it
499 tried to find the dependency information.
500 This might be useful if you
501 don't understand why it's giving you this error.
510 L<dpkg-gensymbols(1)>.