4

I want to know if there is any tool that, given the output of configure, cmake, autoconf or whatever library/dependencies matcher you have; installs the required packages/sources for you from your distro repo.

In other words, some tool that resolves library dependencies for you, installing needed packages depending on your repo, when you want to build a program from source which you don't know which libraries are required.

I give you a random example:
Some time ago I wanted to use Oprofile. It isn't packaged for Ubuntu 14.04 so I had to build for myself.
In the README file it says I have to do ./configure first. I did ./configure once, it threw out an error saying "popt" library wasn't found. I looked up on Internet, I discovered which deb package I had to install for that library, I installed it and I did ./configure again.
Second time, it again threw an error saying liberty library wasn't found. Again, I looked up what library I needed, I found that for Ubuntu it was binutils-dev. But when I tried to install it, It didn't work. Funny enough, that library was in binutils-dev package for ubuntu 12.04, but libiberty-dev for ubuntu 14.04.
For the third time, I finally was able to compile it and run the program

  • I'm not aware of anything like this, but you can do your own package search using apt-file. I.e. apt-file search filename, where filename is whatever library is missing. – Faheem Mitha Feb 23 '15 at 16:22
  • Gentoo calls this emerge/portage. Other source-based distros have equivalent features. For normal rpm/deb distros, there is no such thing AFAIK. – Mat Feb 23 '15 at 16:41
  • @FaheemMitha it's a first approach. But notice that apt-file search popt returns too many results; apt-file search popt.h seems to work, but apt-file search liberty.h does not return any result :( – Akronix Feb 23 '15 at 18:49
  • That is presumably because liberty.h does not exist. – Faheem Mitha Feb 23 '15 at 19:12
  • @mat if it were packaged, he could say apt-get build-deps oprofile. Gentoo isn't the first to specify dependencies, they only decided to reinvent the wheel again... and I doubt any distribution can fully automatically infer dependencies from an unseen configure script. – Anony-Mousse Feb 24 '15 at 8:19
3

No, it can't fully automatically infer dependencies.

If it had been packaged, apt-get build-dep oprofile would have helped. If you can find a package elsewhere, you can look up the dependencies there. For example, if the package exists in the next release of your distribution. e.g. here:

http://archive.ubuntu.com/ubuntu/pool/universe/o/oprofile/oprofile_1.0.0-0ubuntu9.dsc

(and if you plan on compiling things yourself, always consider upgrading to the latest version first!)

Other than that it requires a little bit of experience to figure out. configure scripts unfortunately won't tell you the package names, but usually it's quite easy to find. Also use the search functions on the distribution web pages - they can tell you which packages contain a certain file name.

Instead of iterating through configure attempts, it may be more convenient to look at the configure.ac file, from which the script was generated (and which usually is much shorter). You may be able to discover some optional functionality only offered if certain libraries are installed and some flag is given.

LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB"
BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $Z_LIB"
POPT_LIBS="-lpopt"

are typical library dependencies.

AC_ARG_ENABLE(gui,[  --enable-gui  compile with gui component (qt3|qt4|yes|no),
         if not given or set to yes, gui defaults to qt3],, enable_gui=qt3)

indicates that you may also want to consider QT dependencies if you want a GUI.

  • 1
    It's not exactly what I was looking for but your solutions can work for a large amount of cases, specially apt-get build-dep is very comfortable. – Akronix May 3 '15 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.