Home > Linux, Programming > Finding the package that contains a particular file in Ubuntu

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

 

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

  1. No comments yet.
  1. No trackbacks yet.