dpkg-shlibdeps.1 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. .\" dpkg manual page - dpkg-deb(1)
  2. .\"
  3. .\" Copyright © 1995-1996 Ian Jackson <ian@chiark.chu.cam.ac.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>
  8. .\"
  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.
  13. .\"
  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.
  18. .\"
  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/>.
  21. .
  22. .TH dpkg\-shlibdeps 1 "2013-09-06" "Debian Project" "dpkg utilities"
  23. .SH NAME
  24. dpkg\-shlibdeps \- generate shared library substvar dependencies
  25. .
  26. .SH SYNOPSIS
  27. .B dpkg\-shlibdeps
  28. .RI [ option "...] [" \fB\-e\fP ] executable " [" option ...]
  29. .
  30. .SH DESCRIPTION
  31. .B dpkg\-shlibdeps
  32. calculates shared library dependencies for executables named in its
  33. arguments. The dependencies are added to the substitution
  34. variables file
  35. .B debian/substvars
  36. as variable names
  37. .BI shlibs: dependency-field
  38. where
  39. .I dependency-field
  40. is a dependency field name. Any other variables starting with
  41. .B shlibs:
  42. are removed from the file.
  43. .P
  44. .B dpkg\-shlibdeps
  45. has two possible sources of information to generate dependency
  46. information. Either
  47. .I symbols
  48. files or
  49. .I shlibs
  50. files. For each binary that
  51. .B dpkg\-shlibdeps
  52. analyzes, it finds out the list of libraries that it's linked with.
  53. Then, for each library, it looks up either the
  54. .I symbols
  55. file, or the
  56. .I shlibs
  57. file (if the former doesn't exist or if debian/shlibs.local contains
  58. the relevant dependency). Both files are supposed to be provided
  59. by the library package and should thus be available as
  60. /var/lib/dpkg/info/\fIpackage\fR.\fIsymbols\fR
  61. or /var/lib/dpkg/info/\fIpackage\fR.\fIshlibs\fR. The package name is
  62. identified in two steps: find the library file on the system (looking in
  63. the same directories that \fBld.so\fR would use), then use
  64. .BI "dpkg \-S " library-file
  65. to lookup the package providing the library.
  66. .SS Symbols files
  67. Symbols files contain finer-grained dependency information by providing
  68. the minimum dependency for each symbol that the library exports. The
  69. script tries to find a symbols file associated to a library package
  70. in the following places (first match is used):
  71. .IP debian/*/DEBIAN/symbols
  72. Shared library information generated by the current build process that also invoked
  73. .BR dpkg\-shlibdeps .
  74. They are generated by
  75. .BR dpkg\-gensymbols (1).
  76. They are only used if the library is found in a package's build tree. The
  77. symbols file in that build tree takes precedence over symbols files from
  78. other binary packages.
  79. .IP /etc/dpkg/symbols/\fIpackage\fR.symbols.\fIarch\fR
  80. .IP /etc/dpkg/symbols/\fIpackage\fR.symbols
  81. Per-system overriding shared library dependency information.
  82. \fIarch\fR is the architecture of the current system (obtained by
  83. .BR "dpkg\-architecture \-qDEB_HOST_ARCH" ).
  84. .IP "Output from \(lq\fBdpkg\-query \-\-control\-path\fR \fIpackage\fR symbols\(rq"
  85. Package-provided shared library dependency information.
  86. Unless overridden by \fB\-\-admindir\fP, those files are located in
  87. /var/lib/dpkg.
  88. .P
  89. While scanning the symbols used by all binaries,
  90. .B dpkg\-shlibdeps
  91. remembers the (biggest) minimal version needed for each library. At the end
  92. of the process, it is able to write out the minimal dependency for every
  93. library used (provided that the information of the \fIsymbols\fR files are
  94. accurate).
  95. .P
  96. As a safe-guard measure, a symbols file can provide a
  97. \fBBuild\-Depends\-Package\fP meta-information field and
  98. .B dpkg\-shlibdeps
  99. will extract the minimal version required by the corresponding package in
  100. the \fBBuild\-Depends\fP field and use this version if it's higher than the
  101. minimal version computed by scanning symbols.
  102. .SS Shlibs files
  103. Shlibs files associate directly a library to a dependency (without looking
  104. at the symbols). It's thus often stronger than really needed but very safe
  105. and easy to handle.
  106. .P
  107. The dependencies for a library are looked up in several places. The first
  108. file providing information for the library of interest is used:
  109. .IP debian/shlibs.local
  110. Package-local overriding shared library dependency information.
  111. .IP /etc/dpkg/shlibs.override
  112. Per-system overriding shared library dependency information.
  113. .IP debian/*/DEBIAN/shlibs
  114. Shared library information generated by the current build process that also invoked
  115. .BR dpkg\-shlibdeps .
  116. They are only used if the library is found in a package's build tree. The
  117. shlibs file in that build tree takes precedence over shlibs files from
  118. other binary packages.
  119. .IP "Output from \(lq\fBdpkg\-query \-\-control\-path\fP \fIpackage\fR shlibs\(rq"
  120. Package-provided shared library dependency information.
  121. Unless overridden by \fB\-\-admindir\fP, those files are located in
  122. /var/lib/dpkg.
  123. .IP /etc/dpkg/shlibs.default
  124. Per-system default shared library dependency information.
  125. .P
  126. The extracted dependencies are then directly used (except if they are
  127. filtered out because they have been identified as duplicate, or as weaker
  128. than another dependency).
  129. .SH OPTIONS
  130. .B dpkg\-shlibdeps
  131. interprets non-option arguments as executable names, just as if they'd
  132. been supplied as
  133. .BI \-e executable\fR.
  134. .TP
  135. .BI \-e executable
  136. Include dependencies appropriate for the shared libraries required by
  137. .IR executable .
  138. This option can be used multiple times.
  139. .TP
  140. .BI \-l directory
  141. Add
  142. .I directory
  143. to the list of directories to search for private shared libraries
  144. (since dpkg 1.17.0). This option can be used multiple times.
  145. Note: Use this option instead of setting \fBLD_LIBRARY_PATH\fP,
  146. as that environment variable is used to control the run-time linker
  147. and abusing it to set the shared library paths at build-time can be
  148. problematic when cross-compiling for example.
  149. .TP
  150. .BI \-d dependency-field
  151. Add dependencies to be added to the control file dependency field
  152. .IR dependency-field .
  153. (The dependencies for this field are placed in the variable
  154. .BI shlibs: dependency-field\fR.)
  155. The
  156. .BI \-d dependency-field
  157. option takes effect for all executables after the option, until the
  158. next
  159. .BI \-d dependency-field\fR.
  160. The default
  161. .I dependency-field
  162. is
  163. .BR Depends .
  164. If the same dependency entry (or set of alternatives) appears in more
  165. than one of the recognized dependency field names
  166. .BR Pre\-Depends ", " Depends ", " Recommends ", " Enhances " or " Suggests
  167. then
  168. .B dpkg\-shlibdeps
  169. will automatically remove the dependency from all fields except the
  170. one representing the most important dependencies.
  171. .TP
  172. .BI \-p varname-prefix
  173. Start substitution variables with
  174. .IB varname-prefix :
  175. instead of
  176. .BR shlibs: .
  177. Likewise, any existing substitution variables starting with
  178. .IB varname-prefix :
  179. (rather than
  180. .BR shlibs: )
  181. are removed from the the substitution variables file.
  182. .TP
  183. .BR \-O [\fIfilename\fP]
  184. Print substitution variable settings to standard output (or \fIfilename\fP
  185. if specified, since dpkg 1.17.2), rather than being added to the
  186. substitution variables file
  187. .RB ( debian/substvars
  188. by default).
  189. .TP
  190. .BI \-t type
  191. Prefer shared library dependency information tagged for the given
  192. package type. If no tagged information is available, falls back to untagged
  193. information. The default package type is \fBdeb\fP. Shared library dependency
  194. information is tagged for a given type by prefixing it with the name of the
  195. type, a colon, and whitespace.
  196. .TP
  197. .BI \-L local-shlibs-file
  198. Read overriding shared library dependency information from
  199. .I local-shlibs-file
  200. instead of
  201. .BR debian/shlibs.local .
  202. .TP
  203. .BI \-T substvars-file
  204. Write substitution variables in
  205. .IR substvars-file ;
  206. the default is
  207. .BR debian/substvars .
  208. .TP
  209. .BI \-v
  210. Enable verbose mode (since dpkg 1.14.8).
  211. Numerous messages are displayed to explain what
  212. .B dpkg\-shlibdeps
  213. does.
  214. .TP
  215. .BI \-x package
  216. Exclude the package from the generated dependencies (since dpkg 1.14.8).
  217. This is useful to
  218. avoid self-dependencies for packages which provide ELF binaries
  219. (executables or library plugins) using a library contained in the same
  220. package. This option can be used multiple times to exclude several
  221. packages.
  222. .TP
  223. .BI \-S package-build-dir
  224. Look into \fIpackage-build-dir\fP first when trying to find a library
  225. (since dpkg 1.14.15).
  226. This is
  227. useful when the source package builds multiple flavors of the same library
  228. and you want to ensure that you get the dependency from a given binary
  229. package. You can use this option multiple times: directories will be
  230. tried in the same order before directories of other binary packages.
  231. .TP
  232. .BI \-\-ignore\-missing\-info
  233. Do not fail if dependency information can't be found for a shared library
  234. (since dpkg 1.14.8).
  235. Usage of this option is discouraged, all libraries should provide
  236. dependency information (either with shlibs files, or with symbols files)
  237. even if they are not yet used by other packages.
  238. .TP
  239. .BI \-\-warnings= value
  240. \fIvalue\fP is a bit field defining the set of warnings that
  241. can be emitted by \fBdpkg\-shlibdeps\fP (since dpkg 1.14.17).
  242. Bit 0 (value=1) enables the warning \(lqsymbol \fIsym\fP used by \fIbinary\fP
  243. found in none of the libraries\(rq, bit 1 (value=2) enables the warning
  244. \(lqpackage could avoid a useless dependency\(rq and bit 2 (value=4) enables
  245. the warning \(lq\fIbinary\fP should not be linked against \fIlibrary\fP\(rq.
  246. The default \fIvalue\fP is 3: the first two warnings are active by
  247. default, the last one is not. Set \fIvalue\fP to 7 if you want all
  248. warnings to be active.
  249. .TP
  250. .BI \-\-admindir= dir
  251. Change the location of the \fBdpkg\fR database (since dpkg 1.14.0).
  252. The default location is \fI/var/lib/dpkg\fP.
  253. .TP
  254. .BR \-? ", " \-\-help
  255. Show the usage message and exit.
  256. .TP
  257. .BR \-\-version
  258. Show the version and exit.
  259. .
  260. .SH DIAGNOSTICS
  261. .SS Warnings
  262. Since
  263. .B dpkg\-shlibdeps
  264. analyzes the set of symbols used by each binary of the generated package,
  265. it is able to emit warnings in several cases. They inform you of things
  266. that can be improved in the package. In most cases, those improvements
  267. concern the upstream sources directly. By order of decreasing importance,
  268. here are the various warnings that you can encounter:
  269. .TP
  270. .BI symbol " sym" " used by " binary " found in none of the libraries."
  271. The indicated symbol has not been found in the libraries linked with the
  272. binary. The \fIbinary\fR is most likely a library and it needs to be linked
  273. with an additional library during the build process (option
  274. \fB\-l\fR\fIlibrary\fR of the linker).
  275. .TP
  276. .IB binary " contains an unresolvable reference to symbol " sym ": it's probably a plugin
  277. The indicated symbol has not been found in the libraries linked with the
  278. binary. The \fIbinary\fR is most likely a plugin and the symbol is
  279. probably provided by the program that loads this plugin. In theory a
  280. plugin doesn't have any SONAME but this binary does have one and as such
  281. it could not be clearly identified as such. However the fact that the
  282. binary is stored in a non-public directory is a strong indication
  283. that's it's not a normal shared library. If the binary is really a
  284. plugin, then disregard this warning. But there's always the possibility
  285. that it's a real library and that programs linking to it are using an
  286. RPATH so that the dynamic loader finds it. In that case, the library is
  287. broken and needs to be fixed.
  288. .TP
  289. .BI "package could avoid a useless dependency if " binary " was not linked against " library " (it uses none of the library's symbols)"
  290. None of the \fIbinaries\fP that are linked with \fPlibrary\fP use any of the
  291. symbols provided by the library. By fixing all the binaries, you would avoid
  292. the dependency associated to this library (unless the same dependency is
  293. also generated by another library that is really used).
  294. .TP
  295. .BI "package could avoid a useless dependency if " binaries " were not linked against " library " (they uses none of the library's symbols)"
  296. Exactly the same as the above warning, but for multiple binaries.
  297. .TP
  298. .IB binary " should not be linked against " library " (it uses none of the library's symbols)"
  299. The \fIbinary\fR is linked to a library that it doesn't need. It's not a
  300. problem but some small performance improvements in binary load time can be
  301. obtained by not linking this library to this binary. This warning checks
  302. the same information than the previous one but does it for each binary
  303. instead of doing the check globally on all binaries analyzed.
  304. .SS Errors
  305. .B dpkg\-shlibdeps
  306. will fail if it can't find a public library used by a binary or if this
  307. library has no associated dependency information (either shlibs file or
  308. symbols file). A public library has a SONAME and is versioned
  309. (libsomething.so.\fIX\fR). A private library (like a plugin) should not
  310. have a SONAME and doesn't need to be versioned.
  311. .TP
  312. .BI "couldn't find library " library-soname " needed by " binary " (its RPATH is '" rpath "')"
  313. The \fIbinary\fR uses a library called \fIlibrary-soname\fR but
  314. .B dpkg\-shlibdeps
  315. has been unable to find the library.
  316. .B dpkg\-shlibdeps
  317. creates a list of directories to check as following: directories listed in
  318. the RPATH of the binary, directories listed in /etc/ld.so.conf,
  319. directories added by the \fB\-l\fP option,
  320. directories listed in the \fBLD_LIBRARY_PATH\fP environment variable, and
  321. standard public directories (/lib, /usr/lib, /lib32, /usr/lib32, /lib64,
  322. /usr/lib64). Then it checks those directories in the package's build tree
  323. of the binary being analyzed, in the packages' build trees indicated with
  324. the \fB\-S\fP command-line option, in other packages' build trees that contains
  325. a DEBIAN/shlibs or DEBIAN/symbols file and finally in the root directory.
  326. If the library is not found in any of those directories, then you get this
  327. error.
  328. If the library not found is in a private directory of the same package,
  329. then you want to add the directory with \fB\-l\fP. If it's in another
  330. binary package being built, you want to make sure that the shlibs/symbols
  331. file of this package is already created and that \fB\-l\fP
  332. contains the appropriate directory if it also is in a private directory.
  333. .TP
  334. .BI "no dependency information found for " library-file " (used by " binary ")."
  335. The library needed by \fIbinary\fR has been found by
  336. .B dpkg\-shlibdeps
  337. in \fIlibrary-file\fR but
  338. .B dpkg\-shlibdeps
  339. has been unable to find any dependency information for that library. To
  340. find out the dependency, it has tried to map the library to a Debian
  341. package with the help of
  342. .BI "dpkg \-S " library-file\fR.
  343. Then it checked the corresponding shlibs and symbols files in
  344. /var/lib/dpkg/info/, and in the various package's build trees
  345. (debian/*/DEBIAN/).
  346. This failure can be caused by a bad or missing shlibs or symbols file
  347. in the package of the library. It might also happen if the library is
  348. built within the same source package and if the shlibs files has not yet
  349. been created (in which case you must fix debian/rules to create
  350. the shlibs before calling \fBdpkg\-shlibdeps\fR). Bad RPATH can also
  351. lead to the library being found under a non-canonical name (example:
  352. /usr/lib/openoffice.org/../lib/libssl.so.0.9.8 instead of
  353. /usr/lib/libssl.so.0.9.8) that's not associated to any package,
  354. .B dpkg\-shlibdeps
  355. tries to work around this by trying to fallback on a canonical name (using
  356. .BR realpath (3))
  357. but it might not always work. It's always best to clean up the RPATH
  358. of the binary to avoid problems.
  359. Calling
  360. .B dpkg\-shlibdeps
  361. in verbose mode (\fB\-v\fP) will provide much more information about where it
  362. tried to find the dependency information. This might be useful if you
  363. don't understand why it's giving you this error.
  364. .SH SEE ALSO
  365. .BR deb\-shlibs (5),
  366. .BR deb\-symbols (5),
  367. .BR dpkg\-gensymbols (1).