It's common problem that we get some error like "abc.h no such file"
when compile source. Only way to find the solution(as i know) is search in internet. What i need to do, compile the source, it will give me some errors and then i have to install the dev by searching in internet.
Is there any way that i can get lib package name by the header file name? Assume i need crypto.h
file, libssl-dev
contains this file.
But how could i know? Where should i search for it? Is there any reference site or program?
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$'
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 :)