dpkg-shlibdeps.1 14 KB

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