Skip to main content

apt-search for compiling

Whenever a compile fails with a missing file simply leverage the infrastructure to search for the missing ubuntu package

apt-file search   some_missing_file_goes_here   #  cmd 1    
apt-file search   X11/extensions/Xcomposite.h   #  cmd 1

which returns with

libxcomposite-dev: /usr/include/X11/extensions/Xcomposite.h

so solution is to install that missing package

sudo apt-get install libxcomposite-dev              #  cmd 2

this technique works across any missing file

apt-file search   X11/extensions/Xcomposite.h  

apt-file search   X11/extensions/Xcomposite.h

it will fail with error

The program 'apt-file' is currently not installed. To run 'apt-file' please ask your administrator to install the package 'apt-file'

which just means you need to do a one time setup of the local search cache so just run

sudo apt-get install apt-file -y
sudo apt-file update

re-issue the search shown above (cmd 1) then install package (cmd 2)