How to get appropriate lib package name for a specific header file [duplicate]
Solution 1:
This resembles the question How do I find the package that provides a file?
Since you are looking for packages you don't have in your system, I recommend using apt-file search <header file>
. You can fine-tune your search to avoid expansion (that is, do not list foocrypto.html if you are looking for crypto.h).
Your command would look like apt-file -x search '/crypto.h$'
user@host$ apt-file -x search '/crypto.h$'
aroarfw-dev: /usr/include/aroarfw/crypto.h
asterisk-dev: /usr/include/asterisk/crypto.h
crtmpserver-dev: /usr/include/crtmpserver/common/utils/misc/crypto.h
libfaifa-dev: /usr/include/faifa/crypto.h
libgnutls-dev: /usr/include/gnutls/crypto.h
libntfs-dev: /usr/include/ntfs/crypto.h
libroar-dev: /usr/include/libroar/crypto.h
libsrtp0-dev: /usr/include/srtp/crypto.h
libssl-dev: /usr/include/openssl/crypto.h
libsyslog-ng-dev: /usr/include/syslog-ng/crypto.h
libxmlsec1-dev: /usr/include/xmlsec1/xmlsec/crypto.h
libxmlsec1-dev: /usr/include/xmlsec1/xmlsec/gcrypt/crypto.h
libxmlsec1-dev: /usr/include/xmlsec1/xmlsec/gnutls/crypto.h
libxmlsec1-dev: /usr/include/xmlsec1/xmlsec/nss/crypto.h
libxmlsec1-dev: /usr/include/xmlsec1/xmlsec/openssl/crypto.h
linux-headers-3.2.0-4-amd64: /usr/src/linux-headers-3.2.0-4-amd64/include/config/crypto.h
linux-headers-3.2.0-4-amd64: /usr/src/linux-headers-3.2.0-4-amd64/include/config/rt2x00/lib/crypto.h
linux-headers-3.2.0-4-common: /usr/src/linux-headers-3.2.0-4-common/include/linux/crypto.h
linux-headers-3.2.0-4-common-rt: /usr/src/linux-headers-3.2.0-4-common-rt/include/linux/crypto.h
linux-headers-3.2.0-4-rt-amd64: /usr/src/linux-headers-3.2.0-4-rt-amd64/include/config/crypto.h
linux-headers-3.2.0-4-rt-amd64: /usr/src/linux-headers-3.2.0-4-rt-amd64/include/config/rt2x00/lib/crypto.h
Moreover, if you know beforehand that the package is named something-dev or libsomething-dev you can pipe it to grep
.
apt-file -x search '/crypto.h$' | grep '^lib[^:]*-dev'
This returns only packages named lib*-dev.
Finally, if you only want the name of the packages (and not the path to the file) so you get a nice list of packages (one per line), you can use grep -o
instead.
apt-file -x search '/crypto.h$' | grep -o '^lib[^:]*-dev'
Happy coding :)