An easy way to find missing libs while compiling from source: apt-file

Post Type: 
Tip

Hey folks,

Found this a week or two ago when I was struggling to compile some apps from the source due to missing dependencies and thought I would share it as I've not posted on here yet, and its also a dam handy tool!

The tool in question is apt-file and can be installed from the repos by typing:

    "sudo apt-get install apt-file"

and then entering your password and confirming installation if prompted.

Once installed you can use the command "apt-file search <name_of_file_to_find>" and it will show you a list of the packages / libs in your repo sources that have that file in them.

For example, when I was compiling a program from source I got a whole raft of errors that spawned from me not having the rand.h file from OpenSSL... I tried to install OpenSSL and found that it was already installed so after a bit of searching I came across a post on the net which recommended apt-file for finding a lib for another problem.  I tried it on the missing file ("apt-file search rand.h") and it brought up a whole range of packages which included libssl-dev.. I installed that and it compiled fine.  I've since used this when compiling a number of other packages and its been invaluable for finding missing dependencies.

Hope this helps someone in the future.

Cheers,
Jamie


Comments

Moooooooooooo +10 nice

Moooooooooooo +10 nice one!


Have you moo'ed today?
         (__) 
         (oo) 
   /------\/ 
  / |    ||   
 *  /\---/\ 
   <

aptitude -v -v -v -v moo

Okay, okay, if I give you an Easter Egg, will you go away?

Arron Finnon
President
Abertay Linux Society