In later versions of debian-based systems there’s a command named “apt-file”, it is used to determine which installation package a certain file can be found in.
This can for example be used when something is missing when you compile from source. It may look as follows:
1 2 3 4 5 6 |
make ... In file included from prnt/hpcups/HPCupsFilter.h:34:0, from prnt/hpcups/HPCupsFilter.cpp:33: prnt/hpcups/CommonDefinitions.h:43:25: Fatal Error: cups/raster.h: File or directory does not exist |
The compilation failed because the file “raster.h” could not be found. The file is probably missing and something needs to be installed for it to be put in place. The question then is what is to be installed.
An easy way to determine this is to use the command “apt-file“.
Before running the command it is a good idea to update its database.
1 |
apt-file update |
Then use the command to search for the missing file.
1 |
apt-file search cups / raster.h |
apt-file lists the packages that substantive set the requested file:
1 2 |
libcupsimage2-dev: /usr/include/cups/raster.h lsb-build-base3: /usr/include/lsb3/cups/raster.h |
Then you only need to install the desired package and try to compile again. In this case, two different packages that contain the requested file was listed, it should be enough to install one of them.
Note:
If you get
1 |
usr/bin/apt-file: No such file or directory |
when running the “apt-file” command, simply install it by entering:
1 |
apt-get install apt-file |
Have fun!
1 comment for “Useful debian command: apt-file”