.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "dpkg-shlibdeps 1" .TH dpkg-shlibdeps 1 2024-01-24 1.22.4 "dpkg suite" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME dpkg\-shlibdeps \- generate shared library substvar dependencies .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fBdpkg-shlibdeps\fR [\fIoption\fR...] [\fB\-e\fR] \fIexecutable\fR [\fIoption\fR...] .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBdpkg-shlibdeps\fR calculates shared library dependencies for executables named in its arguments. The dependencies are added to the substitution variables file \&\fBdebian/substvars\fR as variable names \&\fBshlibs:\fR\fIdependency-field\fR where \&\fIdependency-field\fR is a dependency field name. Any other variables starting with \&\fBshlibs:\fR are removed from the file. .PP \&\fBdpkg-shlibdeps\fR has two possible sources of information to generate dependency information. Either \&\fIsymbols\fR files or \&\fIshlibs\fR files. For each binary that \&\fBdpkg-shlibdeps\fR analyzes, it finds out the list of libraries that it's linked with. Then, for each library, it looks up either the \&\fIsymbols\fR file, or the \&\fIshlibs\fR file (if the former doesn't exist or if debian/shlibs.local contains the relevant dependency). Both files are supposed to be provided by the library package and should thus be available as /var/lib/dpkg/info/\fIpackage\fR.\fIsymbols\fR or /var/lib/dpkg/info/\fIpackage\fR.\fIshlibs\fR. The package name is identified in two steps: find the library file on the system (looking in the same directories that \fBld.so\fR would use), then use \&\fBdpkg \-S\fR \fIlibrary-file\fR to lookup the package providing the library. .SS "Symbols files" .IX Subsection "Symbols files" Symbols files contain finer-grained dependency information by providing the minimum dependency for each symbol that the library exports. The script tries to find a symbols file associated to a library package in the following places (first match is used): .IP debian/*/DEBIAN/symbols 4 .IX Item "debian/*/DEBIAN/symbols" Shared library information generated by the current build process that also invoked \&\fBdpkg-shlibdeps\fR. They are generated by \&\fBdpkg\-gensymbols\fR\|(1). They are only used if the library is found in a package's build tree. The symbols file in that build tree takes precedence over symbols files from other binary packages. .IP /etc/dpkg/symbols/\fIpackage\fR.symbols.\fIarch\fR 4 .IX Item "/etc/dpkg/symbols/package.symbols.arch" .PD 0 .IP /etc/dpkg/symbols/\fIpackage\fR.symbols 4 .IX Item "/etc/dpkg/symbols/package.symbols" .PD Per-system overriding shared library dependency information. \&\fIarch\fR is the architecture of the current system (obtained by \&\fBdpkg-architecture \-qDEB_HOST_ARCH\fR). .IP "Output from \(lq\fBdpkg-query \-\-control\-path\fR \fIpackage\fR symbols\(rq" 4 .IX Item "Output from \(lqdpkg-query --control-path package symbols\(rq" Package-provided shared library dependency information. Unless overridden by \fB\-\-admindir\fR, those files are located in /var/lib/dpkg. .PP While scanning the symbols used by all binaries, \&\fBdpkg-shlibdeps\fR remembers the (biggest) minimal version needed for each library. At the end of the process, it is able to write out the minimal dependency for every library used (provided that the information of the \fIsymbols\fR files are accurate). .PP As a safe-guard measure, a symbols file can provide a \&\fBBuild-Depends-Package\fR meta-information field and \&\fBdpkg-shlibdeps\fR will extract the minimal version required by the corresponding package in the \fBBuild-Depends\fR field and use this version if it's higher than the minimal version computed by scanning symbols. .SS "Shlibs files" .IX Subsection "Shlibs files" Shlibs files associate directly a library to a dependency (without looking at the symbols). It's thus often stronger than really needed but very safe and easy to handle. .PP The dependencies for a library are looked up in several places. The first file providing information for the library of interest is used: .IP debian/shlibs.local 4 .IX Item "debian/shlibs.local" Package-local overriding shared library dependency information. .IP /etc/dpkg/shlibs.override 4 .IX Item "/etc/dpkg/shlibs.override" Per-system overriding shared library dependency information. .IP debian/*/DEBIAN/shlibs 4 .IX Item "debian/*/DEBIAN/shlibs" Shared library information generated by the current build process that also invoked \&\fBdpkg-shlibdeps\fR. They are only used if the library is found in a package's build tree. The shlibs file in that build tree takes precedence over shlibs files from other binary packages. .IP "Output from \(lq\fBdpkg-query \-\-control\-path\fR \fIpackage\fR shlibs\(rq" 4 .IX Item "Output from \(lqdpkg-query --control-path package shlibs\(rq" Package-provided shared library dependency information. Unless overridden by \fB\-\-admindir\fR, those files are located in /var/lib/dpkg. .IP /etc/dpkg/shlibs.default 4 .IX Item "/etc/dpkg/shlibs.default" Per-system default shared library dependency information. .PP The extracted dependencies are then directly used (except if they are filtered out because they have been identified as duplicate, or as weaker than another dependency). .SH OPTIONS .IX Header "OPTIONS" \&\fBdpkg-shlibdeps\fR interprets non-option arguments as executable names, just as if they'd been supplied as \&\fB\-e\fR\fIexecutable\fR. .IP \fB\-e\fR\fIexecutable\fR 4 .IX Item "-eexecutable" Include dependencies appropriate for the shared libraries required by \&\fIexecutable\fR. This option can be used multiple times. .IP \fB\-l\fR\fIdirectory\fR 4 .IX Item "-ldirectory" Prepend \&\fIdirectory\fR to the list of directories to search for private shared libraries (since dpkg 1.17.0). This option can be used multiple times. .Sp \&\fBNote\fR: Use this option instead of setting \fBLD_LIBRARY_PATH\fR, as that environment variable is used to control the run-time linker and abusing it to set the shared library paths at build-time can be problematic when cross-compiling for example. .IP \fB\-d\fR\fIdependency-field\fR 4 .IX Item "-ddependency-field" Add dependencies to be added to the control file dependency field \&\fIdependency-field\fR. (The dependencies for this field are placed in the variable \&\fBshlibs:\fR\fIdependency-field\fR.) .Sp The \&\fB\-d\fR\fIdependency-field\fR option takes effect for all executables after the option, until the next \&\fB\-d\fR\fIdependency-field\fR. The default \&\fIdependency-field\fR is \&\fBDepends\fR. .Sp If the same dependency entry (or set of alternatives) appears in more than one of the recognized dependency field names \&\fBPre-Depends\fR, \fBDepends\fR, \fBRecommends\fR, \fBEnhances\fR or \fBSuggests\fR then \&\fBdpkg-shlibdeps\fR will automatically remove the dependency from all fields except the one representing the most important dependencies. .IP \fB\-p\fR\fIvarname-prefix\fR 4 .IX Item "-pvarname-prefix" Start substitution variables with \&\fIvarname-prefix\fR\fB:\fR instead of \&\fBshlibs:\fR. Likewise, any existing substitution variables starting with \&\fIvarname-prefix\fR\fB:\fR (rather than \&\fBshlibs:\fR) are removed from the substitution variables file. .IP \fB\-O\fR[\fIfilename\fR] 4 .IX Item "-O[filename]" Print substitution variable settings to standard output (or \fIfilename\fR if specified, since dpkg 1.17.2), rather than being added to the substitution variables file (\fBdebian/substvars\fR by default). .IP \fB\-t\fR\fItype\fR 4 .IX Item "-ttype" Prefer shared library dependency information tagged for the given package type. If no tagged information is available, falls back to untagged information. The default package type is \fBdeb\fR. Shared library dependency information is tagged for a given type by prefixing it with the name of the type, a colon, and whitespace. .IP \fB\-L\fR\fIlocal-shlibs-file\fR 4 .IX Item "-Llocal-shlibs-file" Read overriding shared library dependency information from \&\fIlocal-shlibs-file\fR instead of \&\fBdebian/shlibs.local\fR. .IP \fB\-T\fR\fIsubstvars-file\fR 4 .IX Item "-Tsubstvars-file" Write substitution variables in \&\fIsubstvars-file\fR; the default is \&\fBdebian/substvars\fR. .IP \fB\-v\fR 4 .IX Item "-v" Enable verbose mode (since dpkg 1.14.8). Numerous messages are displayed to explain what \&\fBdpkg-shlibdeps\fR does. .IP \fB\-x\fR\fIpackage\fR 4 .IX Item "-xpackage" Exclude the package from the generated dependencies (since dpkg 1.14.8). This is useful to avoid self-dependencies for packages which provide ELF binaries (executables or library plugins) using a library contained in the same package. This option can be used multiple times to exclude several packages. .IP \fB\-S\fR\fIpackage-build-dir\fR 4 .IX Item "-Spackage-build-dir" Look into \fIpackage-build-dir\fR first when trying to find a library (since dpkg 1.14.15). This is useful when the source package builds multiple flavors of the same library and you want to ensure that you get the dependency from a given binary package. You can use this option multiple times: directories will be tried in the same order before directories of other binary packages. .IP \fB\-I\fR\fIpackage-build-dir\fR 4 .IX Item "-Ipackage-build-dir" Ignore \fIpackage-build-dir\fR when looking for shlibs, symbols, and shared library files (since dpkg 1.18.5). You can use this option multiple times. .IP \fB\-\-ignore\-missing\-info\fR 4 .IX Item "--ignore-missing-info" Do not fail if dependency information can't be found for a shared library (since dpkg 1.14.8). Usage of this option is discouraged, all libraries should provide dependency information (either with shlibs files, or with symbols files) even if they are not yet used by other packages. .IP \fB\-\-warnings=\fR\fIvalue\fR 4 .IX Item "--warnings=value" \&\fIvalue\fR is a bit field defining the set of warnings that can be emitted by \fBdpkg-shlibdeps\fR (since dpkg 1.14.17). Bit 0 (value=1) enables the warning \(lqsymbol \fIsym\fR used by \fIbinary\fR found in none of the libraries\(rq, bit 1 (value=2) enables the warning \(lqpackage could avoid a useless dependency\(rq and bit 2 (value=4) enables the warning \(lq\fIbinary\fR should not be linked against \fIlibrary\fR\(rq. The default \fIvalue\fR is 3: the first two warnings are active by default, the last one is not. Set \fIvalue\fR to 7 if you want all warnings to be active. .IP \fB\-\-admindir=\fR\fIdir\fR 4 .IX Item "--admindir=dir" Change the location of the \fBdpkg\fR database (since dpkg 1.14.0). The default location is \fI/var/lib/dpkg\fR. .IP "\fB\-?\fR, \fB\-\-help\fR" 4 .IX Item "-?, --help" Show the usage message and exit. .IP \fB\-\-version\fR 4 .IX Item "--version" Show the version and exit. .SH ENVIRONMENT .IX Header "ENVIRONMENT" .IP \fBDPKG_COLORS\fR 4 .IX Item "DPKG_COLORS" Sets the color mode (since dpkg 1.18.5). The currently accepted values are: \fBauto\fR (default), \fBalways\fR and \&\fBnever\fR. .IP \fBDPKG_NLS\fR 4 .IX Item "DPKG_NLS" If set, it will be used to decide whether to activate Native Language Support, also known as internationalization (or i18n) support (since dpkg 1.19.0). The accepted values are: \fB0\fR and \fB1\fR (default). .SH DIAGNOSTICS .IX Header "DIAGNOSTICS" .SS Warnings .IX Subsection "Warnings" Since \&\fBdpkg-shlibdeps\fR analyzes the set of symbols used by each binary of the generated package, it is able to emit warnings in several cases. They inform you of things that can be improved in the package. In most cases, those improvements concern the upstream sources directly. By order of decreasing importance, here are the various warnings that you can encounter: .IP "\fBsymbol\fR \fIsym\fR \fBused by\fR \fIbinary\fR \fBfound in none of the libraries.\fR" 4 .IX Item "symbol sym used by binary found in none of the libraries." The indicated symbol has not been found in the libraries linked with the binary. The \fIbinary\fR is most likely a library and it needs to be linked with an additional library during the build process (option \&\fB\-l\fR\fIlibrary\fR of the linker). .IP "\fIbinary\fR \fBcontains an unresolvable reference to symbol\fR \fIsym\fR\fB: it's probably a plugin\fR" 4 .IX Item "binary contains an unresolvable reference to symbol sym: it's probably a plugin" The indicated symbol has not been found in the libraries linked with the binary. The \fIbinary\fR is most likely a plugin and the symbol is probably provided by the program that loads this plugin. In theory a plugin doesn't have any SONAME but this binary does have one and as such it could not be clearly identified as such. However the fact that the binary is stored in a non-public directory is a strong indication that's it's not a normal shared library. If the binary is really a plugin, then disregard this warning. But there's always the possibility that it's a real library and that programs linking to it are using an RPATH so that the dynamic loader finds it. In that case, the library is broken and needs to be fixed. .IP "\fBpackage could avoid a useless dependency if\fR \fIbinary\fR \fBwas not linked against\fR \fIlibrary\fR \fB(it uses none of the library's symbols)\fR" 4 .IX Item "package could avoid a useless dependency if binary was not linked against library (it uses none of the library's symbols)" None of the \fIbinaries\fR that are linked with \fIlibrary\fR use any of the symbols provided by the library. By fixing all the binaries, you would avoid the dependency associated to this library (unless the same dependency is also generated by another library that is really used). .IP "\fBpackage could avoid a useless dependency if\fR \fIbinaries\fR \fBwere not linked against\fR \fIlibrary\fR \fB(they use none of the library's symbols)\fR" 4 .IX Item "package could avoid a useless dependency if binaries were not linked against library (they use none of the library's symbols)" Exactly the same as the above warning, but for multiple binaries. .IP "\fIbinary\fR \fBshould not be linked against\fR \fIlibrary\fR \fB(it uses none of the library's symbols)\fR" 4 .IX Item "binary should not be linked against library (it uses none of the library's symbols)" The \fIbinary\fR is linked to a library that it doesn't need. It's not a problem but some small performance improvements in binary load time can be obtained by not linking this library to this binary. This warning checks the same information as the previous one but does it for each binary instead of doing the check globally on all binaries analyzed. .SS Errors .IX Subsection "Errors" \&\fBdpkg-shlibdeps\fR will fail if it can't find a public library used by a binary or if this library has no associated dependency information (either shlibs file or symbols file). A public library has a SONAME and is versioned (libsomething.so.\fIX\fR). A private library (like a plugin) should not have a SONAME and doesn't need to be versioned. .IP "\fBcouldn't find library\fR \fIlibrary-soname\fR \fBneeded by\fR \fIbinary\fR \fB(its RPATH is '\fR\fIrpath\fR\fB')\fR" 4 .IX Item "couldn't find library library-soname needed by binary (its RPATH is 'rpath')" The \fIbinary\fR uses a library called \fIlibrary-soname\fR but \&\fBdpkg-shlibdeps\fR has been unable to find the library. \&\fBdpkg-shlibdeps\fR creates a list of directories to check as following: directories listed in the RPATH of the binary, directories added by the \fB\-l\fR option, directories listed in the \fBLD_LIBRARY_PATH\fR environment variable, cross multiarch directories (ex. /lib/arm64\-linux\-gnu, /usr/lib/arm64\-linux\-gnu), standard public directories (/lib, /usr/lib), directories listed in /etc/ld.so.conf, and obsolete multilib directories (/lib32, /usr/lib32, /lib64, /usr/lib64). Then it checks those directories in the package's build tree of the binary being analyzed, in the packages' build trees indicated with the \fB\-S\fR command-line option, in other packages' build trees that contains a DEBIAN/shlibs or DEBIAN/symbols file and finally in the root directory. If the library is not found in any of those directories, then you get this error. .Sp If the library not found is in a private directory of the same package, then you want to add the directory with \fB\-l\fR. If it's in another binary package being built, you want to make sure that the shlibs/symbols file of this package is already created and that \fB\-l\fR contains the appropriate directory if it also is in a private directory. .IP "\fBno dependency information found for\fR \fIlibrary-file\fR \fB(used by\fR \fIbinary\fR\fB).\fR" 4 .IX Item "no dependency information found for library-file (used by binary)." The library needed by \fIbinary\fR has been found by \&\fBdpkg-shlibdeps\fR in \fIlibrary-file\fR but \&\fBdpkg-shlibdeps\fR has been unable to find any dependency information for that library. To find out the dependency, it has tried to map the library to a Debian package with the help of \&\fBdpkg \-S\fR \fIlibrary-file\fR. Then it checked the corresponding shlibs and symbols files in /var/lib/dpkg/info/, and in the various package's build trees (debian/*/DEBIAN/). .Sp This failure can be caused by a bad or missing shlibs or symbols file in the package of the library. It might also happen if the library is built within the same source package and if the shlibs files has not yet been created (in which case you must fix debian/rules to create the shlibs before calling \fBdpkg-shlibdeps\fR). Bad RPATH can also lead to the library being found under a non-canonical name (example: /usr/lib/openoffice.org/../lib/libssl.so.0.9.8 instead of /usr/lib/libssl.so.0.9.8) that's not associated to any package, \&\fBdpkg-shlibdeps\fR tries to work around this by trying to fallback on a canonical name (using \&\fBrealpath\fR\|(3)) but it might not always work. It's always best to clean up the RPATH of the binary to avoid problems. .Sp Calling \&\fBdpkg-shlibdeps\fR in verbose mode (\fB\-v\fR) will provide much more information about where it tried to find the dependency information. This might be useful if you don't understand why it's giving you this error. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBdeb\-substvars\fR\|(5), \&\fBdeb\-shlibs\fR\|(5), \&\fBdeb\-symbols\fR\|(5), \&\fBdpkg\-gensymbols\fR\|(1).