Finding the package that contains a particular file in Ubuntu

It often happens that a file is missing during compilation and you get this kind of error:

In file included from media/audio/linux/audio_manager_linux.cc:15:0:
./media/audio/linux/alsa_input.h:8:28: fatal error: alsa/asoundlib.h: No such file or directory
compilation terminated.
In file included from media/audio/linux/alsa_input.cc:5:0:
./media/audio/linux/alsa_input.h:8:28: fatal error: alsa/asoundlib.h: No such file or directory
compilation terminated.

That usually means a development package is missing. Sometime you can just guess the name of the package or you can use aptitude to find the file.

There is also another (better) method in Ubuntu: apt-file utility allows you to find the package corresponding to a particular file.

First install apt-file

sudo apt-get install apt-file

Them the first time, you need to download the files with the data for your system

apt-file update

Finally, you can use apt-file to find the package. For example with alsa/asoundlib.h

apt-file search alsa/asoundlib.h
libasound2-dev: /usr/include/alsa/asoundlib.h

 

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
0 Comments
oldest
newest
Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...