0

Is it possible to get autoconf based build systems to show the libraries it found and will link against, before building the software? As-is my current workflow is:

$ cd tps-source-dir
$ ./configure --options-i-know-to-pass
$ make
$ DESTDIR=~/install make install
$ find ~/install -name "*.so*" -exec ldd \{\} \;
Crap it found the wrong version of libfoo, try again.

It would be really nice to learn exactly which libraries it was going to use before spending hours compiling a large package.

1
  • First, read Stephen Kitt's answer. AUTOCONFIG does only what the programmer tells it to do, which usually--but not always---creates a suitable Makefile, and caches various bits of information in other files, such as the config.status file. This may not be enough for your desired situation. You will need to read the documentation provided by the source package, and/or examine the Makefile to see what it is looking for.
    – C. M.
    Jul 3, 2021 at 15:47

1 Answer 1

3

Some configure scripts do this already, but there’s no generic way to get configure itself to output a nice list of the libraries it’s found.

However all the information is available in config.status and config.log. You’ll get the libraries found by running

grep LIBS config.status

and the relevant flags, if any, using

grep LDFLAGS config.status

All this is stored as compiler flags, so you can also search for -l, -L, and -I for headers.

6
  • Thanks. In my case, it looks like all the packages I'm building this week simply check if a library exists in the configured path and if is a suitable version (or has the features needed), but don't record the path of that library, just use what the linker provides them with -lfoo. But it is helpful to know when to stop looking for features that don't exist :)
    – pavon
    Jul 5, 2021 at 15:58
  • I might try adding a simple hello_world target to the Makefile, and see how much customization that needs from project to project to ensure it is built with the same options as the real targets.
    – pavon
    Jul 5, 2021 at 16:02
  • Or setup an inotify watch for the first .so that is built, so I can abort earlier if needed.
    – pavon
    Jul 5, 2021 at 16:03
  • Yes, that’s quite common – if -lfoo works, there’s no need to dig any further (from ./configure’s perspective). You can look for a --with-foo option if necessary, that usually provides a way to override the library location used. Jul 5, 2021 at 16:03
  • 1
    LD_LIBRARY_PATH is a runtime configuration variable, you need to specify LDFLAGS for build-time library settings. Jul 5, 2021 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .