1dpkg-shlibdeps(1)                 dpkg suite                 dpkg-shlibdeps(1)
2
3
4

NAME

6       dpkg-shlibdeps - generate shared library substvar dependencies
7

SYNOPSIS

9       dpkg-shlibdeps [option...] [-e]executable [option...]
10

DESCRIPTION

12       dpkg-shlibdeps  calculates  shared library dependencies for executables
13       named in its arguments. The dependencies are added to the  substitution
14       variables  file  debian/substvars  as variable names shlibs:dependency-
15       field where dependency-field is a  dependency  field  name.  Any  other
16       variables starting with shlibs: are removed from the file.
17
18       dpkg-shlibdeps  has  two  possible  sources  of information to generate
19       dependency information. Either symbols files or shlibs files. For  each
20       binary that dpkg-shlibdeps analyzes, it finds out the list of libraries
21       that it's linked with.  Then, for each library, it looks up either  the
22       symbols  file,  or  the  shlibs file (if the former doesn't exist or if
23       debian/shlibs.local contains the relevant dependency). Both  files  are
24       supposed  to  be  provided  by  the  library package and should thus be
25       available        as        /var/lib/dpkg/info/package.symbols        or
26       /var/lib/dpkg/info/package.shlibs.  The  package  name is identified in
27       two steps: find the library file on the system  (looking  in  the  same
28       directories  that  ld.so  would  use), then use dpkg -S library-file to
29       lookup the package providing the library.
30
31   Symbols files
32       Symbols files contain finer-grained dependency information by providing
33       the  minimum  dependency  for each symbol that the library exports. The
34       script tries to find a symbols file associated to a library package  in
35       the following places (first match is used):
36
37       debian/*/DEBIAN/symbols
38              Shared  library  information  generated  by  the  current  build
39              process that also invoked dpkg-shlibdeps.  They are generated by
40              dpkg-gensymbols(1).   They are only used if the library is found
41              in a package's build tree. The symbols file in that  build  tree
42              takes precedence over symbols files from other binary packages.
43
44       /etc/dpkg/symbols/package.symbols.arch
45
46       /etc/dpkg/symbols/package.symbols
47              Per-system  overriding  shared  library  dependency information.
48              arch is the architecture of  the  current  system  (obtained  by
49              dpkg-architecture -qDEB_HOST_ARCH).
50
51       Output from “dpkg-query --control-path package symbols”
52              Package-provided  shared library dependency information.  Unless
53              overridden  by  --admindir,   those   files   are   located   in
54              /var/lib/dpkg.
55
56       While  scanning  the  symbols  used  by  all  binaries,  dpkg-shlibdeps
57       remembers the (biggest) minimal version needed for each library. At the
58       end  of the process, it is able to write out the minimal dependency for
59       every library used (provided that the information of the symbols  files
60       are accurate).
61
62       As   a   safe-guard   measure,   a   symbols   file   can   provide   a
63       Build-Depends-Package meta-information field  and  dpkg-shlibdeps  will
64       extract  the  minimal  version required by the corresponding package in
65       the Build-Depends field and use this version if it's  higher  than  the
66       minimal version computed by scanning symbols.
67
68   Shlibs files
69       Shlibs  files  associate  directly  a  library to a dependency (without
70       looking at the symbols). It's thus often stronger  than  really  needed
71       but very safe and easy to handle.
72
73       The  dependencies  for  a  library are looked up in several places. The
74       first file providing information for the library of interest is used:
75
76       debian/shlibs.local
77              Package-local overriding shared library dependency information.
78
79       /etc/dpkg/shlibs.override
80              Per-system overriding shared library dependency information.
81
82       debian/*/DEBIAN/shlibs
83              Shared  library  information  generated  by  the  current  build
84              process that also invoked dpkg-shlibdeps.  They are only used if
85              the library is found in a package's build tree. The shlibs  file
86              in that build tree takes precedence over shlibs files from other
87              binary packages.
88
89       Output from “dpkg-query --control-path package shlibs”
90              Package-provided shared library dependency information.   Unless
91              overridden   by   --admindir,   those   files   are  located  in
92              /var/lib/dpkg.
93
94       /etc/dpkg/shlibs.default
95              Per-system default shared library dependency information.
96
97       The extracted dependencies are then directly used (except if  they  are
98       filtered  out  because  they  have  been identified as duplicate, or as
99       weaker than another dependency).
100

OPTIONS

102       dpkg-shlibdeps interprets non-option  arguments  as  executable  names,
103       just as if they'd been supplied as -eexecutable.
104
105       -eexecutable
106              Include   dependencies  appropriate  for  the  shared  libraries
107              required by executable.  This option can be used multiple times.
108
109       -ldirectory
110              Prepend directory to the  list  of  directories  to  search  for
111              private shared libraries (since dpkg 1.17.0). This option can be
112              used multiple times.
113
114              Note: Use this option instead  of  setting  LD_LIBRARY_PATH,  as
115              that environment variable is used to control the run-time linker
116              and abusing it to set the shared library paths at build-time can
117              be problematic when cross-compiling for example.
118
119       -ddependency-field
120              Add  dependencies  to  be  added  to the control file dependency
121              field dependency-field.  (The dependencies for  this  field  are
122              placed in the variable shlibs:dependency-field.)
123
124              The  -ddependency-field  option takes effect for all executables
125              after  the  option,  until  the  next  -ddependency-field.   The
126              default dependency-field is Depends.
127
128              If the same dependency entry (or set of alternatives) appears in
129              more  than  one  of  the  recognized  dependency   field   names
130              Pre-Depends,  Depends,  Recommends,  Enhances  or  Suggests then
131              dpkg-shlibdeps will automatically remove the dependency from all
132              fields   except   the   one   representing  the  most  important
133              dependencies.
134
135       -pvarname-prefix
136              Start substitution variables  with  varname-prefix:  instead  of
137              shlibs:.  Likewise, any existing substitution variables starting
138              with varname-prefix: (rather than shlibs:) are removed from  the
139              substitution variables file.
140
141       -O[filename]
142              Print  substitution  variable  settings  to  standard output (or
143              filename if specified, since dpkg  1.17.2),  rather  than  being
144              added  to  the  substitution variables file (debian/substvars by
145              default).
146
147       -ttype Prefer shared library  dependency  information  tagged  for  the
148              given package type. If no tagged information is available, falls
149              back to untagged information. The default package type  is  deb.
150              Shared library dependency information is tagged for a given type
151              by prefixing it  with  the  name  of  the  type,  a  colon,  and
152              whitespace.
153
154       -Llocal-shlibs-file
155              Read  overriding  shared  library  dependency  information  from
156              local-shlibs-file instead of debian/shlibs.local.
157
158       -Tsubstvars-file
159              Write substitution variables in substvars-file; the  default  is
160              debian/substvars.
161
162       -v     Enable  verbose mode (since dpkg 1.14.8).  Numerous messages are
163              displayed to explain what dpkg-shlibdeps does.
164
165       -xpackage
166              Exclude the package from the generated dependencies (since  dpkg
167              1.14.8).  This is useful to avoid self-dependencies for packages
168              which provide ELF  binaries  (executables  or  library  plugins)
169              using  a  library contained in the same package. This option can
170              be used multiple times to exclude several packages.
171
172       -Spackage-build-dir
173              Look into package-build-dir first when trying to find a  library
174              (since  dpkg  1.14.15).   This is useful when the source package
175              builds multiple flavors of the same  library  and  you  want  to
176              ensure  that you get the dependency from a given binary package.
177              You can use this option  multiple  times:  directories  will  be
178              tried  in  the  same  order  before  directories of other binary
179              packages.
180
181       -Ipackage-build-dir
182              Ignore package-build-dir when looking for shlibs,  symbols,  and
183              shared  library  files  (since  dpkg  1.18.5).  You can use this
184              option multiple times.
185
186       --ignore-missing-info
187              Do not fail if dependency  information  can't  be  found  for  a
188              shared  library  (since  dpkg  1.14.8).  Usage of this option is
189              discouraged, all libraries should provide dependency information
190              (either  with  shlibs files, or with symbols files) even if they
191              are not yet used by other packages.
192
193       --warnings=value
194              value is a bit field defining the set of warnings  that  can  be
195              emitted by dpkg-shlibdeps (since dpkg 1.14.17).  Bit 0 (value=1)
196              enables the warning “symbol sym used by binary found in none  of
197              the  libraries”,  bit  1  (value=2) enables the warning “package
198              could avoid a useless dependency” and bit  2  (value=4)  enables
199              the  warning “binary should not be linked against library”.  The
200              default value is  3:  the  first  two  warnings  are  active  by
201              default,  the  last  one  is not. Set value to 7 if you want all
202              warnings to be active.
203
204       --admindir=dir
205              Change the location of the dpkg database  (since  dpkg  1.14.0).
206              The default location is /var/lib/dpkg.
207
208       -?, --help
209              Show the usage message and exit.
210
211       --version
212              Show the version and exit.
213

DIAGNOSTICS

215   Warnings
216       Since dpkg-shlibdeps analyzes the set of symbols used by each binary of
217       the generated package, it is able to emit warnings  in  several  cases.
218       They  inform you of things that can be improved in the package. In most
219       cases, those improvements concern the  upstream  sources  directly.  By
220       order  of decreasing importance, here are the various warnings that you
221       can encounter:
222
223       symbol sym used by binary found in none of the libraries.
224              The indicated symbol has not been found in the libraries  linked
225              with  the  binary.  The  binary  is most likely a library and it
226              needs to be linked with an additional library during  the  build
227              process (option -llibrary of the linker).
228
229       binary  contains an unresolvable reference to symbol sym: it's probably
230       a plugin
231              The indicated symbol has not been found in the libraries  linked
232              with  the  binary.  The  binary  is most likely a plugin and the
233              symbol is probably provided  by  the  program  that  loads  this
234              plugin.  In  theory  a  plugin  doesn't have any SONAME but this
235              binary does have one  and  as  such  it  could  not  be  clearly
236              identified  as  such. However the fact that the binary is stored
237              in a non-public directory is a strong indication that's it's not
238              a  normal shared library. If the binary is really a plugin, then
239              disregard this warning. But there's always the possibility  that
240              it's a real library and that programs linking to it are using an
241              RPATH so that the dynamic loader finds it.  In  that  case,  the
242              library is broken and needs to be fixed.
243
244       package  could  avoid  a  useless  dependency  if binary was not linked
245       against library (it uses none of the library's symbols)
246              None of the binaries that are linked with library use any of the
247              symbols provided by the library. By fixing all the binaries, you
248              would avoid the dependency associated to  this  library  (unless
249              the same dependency is also generated by another library that is
250              really used).
251
252       package could avoid a useless dependency if binaries  were  not  linked
253       against library (they use none of the library's symbols)
254              Exactly  the  same  as  the  above  warning,  but  for  multiple
255              binaries.
256
257       binary should not be linked  against  library  (it  uses  none  of  the
258       library's symbols)
259              The binary is linked to a library that it doesn't need. It's not
260              a problem but some small performance improvements in binary load
261              time can be obtained by not linking this library to this binary.
262              This warning checks the same information as the previous one but
263              does  it  for each binary instead of doing the check globally on
264              all binaries analyzed.
265
266   Errors
267       dpkg-shlibdeps will fail if it can't find a public library  used  by  a
268       binary  or  if  this  library  has no associated dependency information
269       (either shlibs file or symbols file). A public library has a SONAME and
270       is  versioned  (libsomething.so.X).  A  private library (like a plugin)
271       should not have a SONAME and doesn't need to be versioned.
272
273       couldn't find library library-soname needed by  binary  (its  RPATH  is
274       'rpath')
275              The   binary   uses   a   library   called   library-soname  but
276              dpkg-shlibdeps  has   been   unable   to   find   the   library.
277              dpkg-shlibdeps  creates  a  list  of  directories  to  check  as
278              following: directories  listed  in  the  RPATH  of  the  binary,
279              directories  added  by  the -l option, directories listed in the
280              LD_LIBRARY_PATH   environment    variable,    cross    multiarch
281              directories   (ex.  /lib/arm64-linux-gnu,  /usr/lib/arm64-linux-
282              gnu), standard public directories (/lib, /usr/lib),  directories
283              listed  in  /etc/ld.so.conf,  and  obsolete multilib directories
284              (/lib32, /usr/lib32, /lib64, /usr/lib64).  Then it checks  those
285              directories  in  the  package's  build  tree of the binary being
286              analyzed, in the packages' build trees  indicated  with  the  -S
287              command-line   option,  in  other  packages'  build  trees  that
288              contains a DEBIAN/shlibs or DEBIAN/symbols file and  finally  in
289              the root directory.  If the library is not found in any of those
290              directories, then you get this error.
291
292              If the library not found is in a private directory of  the  same
293              package,  then you want to add the directory with -l. If it's in
294              another binary package being built, you want to make  sure  that
295              the  shlibs/symbols  file of this package is already created and
296              that -l contains the appropriate directory if it also  is  in  a
297              private directory.
298
299       no dependency information found for library-file (used by binary).
300              The library needed by binary has been found by dpkg-shlibdeps in
301              library-file but dpkg-shlibdeps has  been  unable  to  find  any
302              dependency  information  for  that  library.  To  find  out  the
303              dependency, it has tried to map the library to a Debian  package
304              with  the  help  of  dpkg  -S library-file.  Then it checked the
305              corresponding shlibs and symbols files  in  /var/lib/dpkg/info/,
306              and in the various package's build trees (debian/*/DEBIAN/).
307
308              This failure can be caused by a bad or missing shlibs or symbols
309              file in the package of the library. It might also happen if  the
310              library  is  built  within  the  same  source package and if the
311              shlibs files has not yet been created (in which  case  you  must
312              fix   debian/rules   to   create   the   shlibs  before  calling
313              dpkg-shlibdeps). Bad RPATH can also lead to  the  library  being
314              found      under      a     non-canonical     name     (example:
315              /usr/lib/openoffice.org/../lib/libssl.so.0.9.8    instead     of
316              /usr/lib/libssl.so.0.9.8)  that's not associated to any package,
317              dpkg-shlibdeps tries to work around this by trying  to  fallback
318              on  a canonical name (using realpath(3)) but it might not always
319              work. It's always best to clean up the RPATH of  the  binary  to
320              avoid problems.
321
322              Calling  dpkg-shlibdeps  in  verbose mode (-v) will provide much
323              more information about where it tried  to  find  the  dependency
324              information.  This  might  be useful if you don't understand why
325              it's giving you this error.
326

SEE ALSO

328       deb-shlibs(5), deb-symbols(5), dpkg-gensymbols(1).
329
330
331
3321.18.25                           2018-06-26                 dpkg-shlibdeps(1)
Impressum