6

I have compiled a package that uses autotools as build system (autoreconf, ./configure, make, make install).

./configure stops when a package is missing.

For each missing package, I look up its name, then either I do apt install package or I compile it from source if not available.

Then I run ./configure again and it tells me the name of another unsatisfied dependency.

If there are only one or two missing packages, this is ok. But there were 19!

libmspack-dev
libglib2.0-dev
libpam0g-dev
libssl-dev
libxml2-dev
libxmlsec1-dev
libx11-dev
libcunit1-dev
libxext-dev
libxinerama-dev
libxi-dev
libxrender-dev
libxrandr-dev
libxtst-dev
libgdk-pixbuf2.0-dev
libgtk-3-dev
libgtkmm-3.0-dev
libtool
dnet

I would like ./configure to continue on error, and show me all missing packages at once, so I can install them all at once. Otherwise it is long and painful to run ./configure and apt install 19 times.

  • The package is open-vm-tools available here – Bilow Jul 27 '18 at 9:02
  • 1. Unfortunately auto-apt run ./configure does nothing but run ./configure 2. I can't find the dependencies in the documentation 3. apt is quite fast, what's slow is to type apt install and run configure 19 times 4. apt build-dep open-vm-tools helps but doesn't solve the problem. There is room for improvement here... I'll probably submit PR some day – Bilow Jul 27 '18 at 12:18
8

The simple approach in your case is to install the open-vm-tools package.

To address your question, there is no fool-proof way of listing all missing packages at once, mostly because this wasn’t designed in and configure scripts allow their authors to do anything — so there’s no way to know in advance how to continue and whether continuing is safe. An example of the kind of issue you could run into is tests which build upon the results of previous tests; e.g. check for an installed program, fail if it isn’t installed, and use it in subsequent tests if it is. Continuing if the program is absent isn’t going to give very useful results.

However, in many cases you can get useful results by tweaking configure to not exit when it encounters an error. Typically, this involves replacing AC_MSG_ERROR with AC_MSG_WARN, in configure.ac and any M4 library used by configure.ac:

sed -i 's/AC_MSG_ERROR/AC_MSG_WARN/g' configure.ac m4/*.m4
autoreconf -i
./configure ...

and look for “WARNING:” messages.

You should of course restore configure.ac and the M4 libraries before you attempt to build the software “properly”.

Looking at this more generally, there are other ways to determine dependencies. In many cases, they’re listed in the documentation (README, INSTALL...), sometimes even with corresponding package names for popular distributions. Another useful place to look is configure itself, either by running ./configure --help or by reading configure.ac (or CMakeLists.txt or meson.build or whatever file is appropriate for the build tool being used). If the software you’re looking at is packaged in a Linux distribution, you can look at the metadata there too, although it will only correspond to the version of the software being packaged, and will reflect the maintainer’s packaging choices (apt showsrc ... in Debian derivatives).

| improve this answer | |
  • 1
    Even if it won't work 100% of the time, this is a nice workaround. Now I can ./configure | grep WARNING and install most of the packages at once. open-vm-tools is outdated on apt. Thank you! – Bilow Jul 27 '18 at 12:35
  • Good answer - curious - is the situation the same with Cmake - just wondering if other build systems have "solved" this problem – Steven Penny Jul 27 '18 at 14:50
  • 1
    Most build tools (at least those that try to compete with Autoconf & co., such as CMake or Meson) have the same basic issue — they provide build script authors with too much lee-way to be able to list all missing dependencies. I’m not familiar enough with either to know whether a similar workaround exists. Package build tools are capable of listing all missing dependencies, but they’re much more limited — in particular they generally don’t handle optional dependencies or cascading dependencies (if dependency A is available, B is also needed, but building without A and B is possible). – Stephen Kitt Jul 27 '18 at 15:13
  • This is the halting problem all over again. – Braiam Jul 27 '18 at 15:50
  • @Braiam usually you'd want your ./configure script to halt... – Program man Jul 27 '18 at 18:55
5

This answer is meant to show a quick way of installing missing dependencies on Debian and Ubuntu (which, if I understand it correctly, is what you actually want to achieve), but does not address your question about making ./configure report all dependencies at once.


If the software you want to build is already in the repositories (which is the case with open-vm-tools in Ubuntu, for instance), you can do:

$ apt-get build-dep <packagename>

This will install all the dependencies needed to build that particular version of the package. This is admittedly not the same since the dependency list may somewhat differ between the two versions, but should install the majority (or all) of the missing dependencies.

| improve this answer | |
  • 1
    Unfortunately this doesn't help much with open-vm-tools as numerous dependencies aren't the same, but build-dep is indeed a good idea. Maybe it will work for other packages. – Bilow Jul 27 '18 at 12:18
  • 1
    @Bilow Aw, that's unfortunate! Usually it works well unless you are building the package whose version is wildly different, or you enabled a bunch of additional features that are turned off in the repo version. – undercat applauds Monica Jul 27 '18 at 12:21

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.