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