dpkg-shlibdeps.1 13 KB

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