Opened 11 years ago
#3488 new defect
require_pkg_config() dies with useless error message when pkg-config is missing
Reported by: | Actium | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | build system |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
Enable an external library that is ./configure'd via require_pkg_config(), e.g. opus, with pkg-config not being installed. ./configure dies complaining that the library was "not found", although it is properly installed (after all everything works fine if pkg-config is installed). This error message is unhelpful if not misleading.
Actually an appropriate error message gets generated
configure:2913: if ! $pkg_config --version >/dev/null 2>&1; then warn "$pkg_config not found, library detection may fail." pkg_config=false fi
but since warn() defers the output of warnings and require_pkg_config() dies too early
configure:1158: check_pkg_config "$@" || die "ERROR: $pkg not found"
the warning is only placed in config.log, but ~1.5k lines away from the "ERROR: $pkg not found" and thus quite difficult to stumble upon (I only found the warning after I started taking apart the configure script).
How to reproduce:
# aptitude purge pkg-config $ git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git ffmpeg ; cd ffmpeg $ ./configure --enable-libopus ERROR: opus not found If you think configure made a mistake, make sure [...]
Suggested fix
Since $pkg_config is set to false if pkg-config is not available
configure:2914: if ! $pkg_config --version >/dev/null 2>&1; then warn "$pkg_config not found, library detection may fail." pkg_config=false fi
require_pkg_config() could easily be patched to die with a meaningful error message in that case (see attached patch).
Alternatively die() could be modified to output deferred warnings or warn() could print messages immediately.