Bug 36039 - PKG_CHECK_MODULES doesn't detect missing dependencies
Summary: PKG_CHECK_MODULES doesn't detect missing dependencies
Status: RESOLVED FIXED
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Tollef Fog Heen
QA Contact:
URL:
Whiteboard:
Keywords:
: 29736 30937 64674 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-06 14:32 UTC by Cyril Brulebois
Modified: 2013-05-19 07:26 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Cyril Brulebois 2011-04-06 14:32:15 UTC
(With Debian's 0.25-1.1)

First test case, mimicking the issue I had:

configure.ac:
---
AC_INIT
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES(BUG, buga)

buga.pc:
---
Name: buga
Description: Bug testcase A
Version: 1
Requires: bugb >= 42

bugb.pc:
---
Name: bugb
Description: Bug testcase B
Version: 1


Running that leads to:
---
autoreconf -vfi && PKG_CONFIG_PATH=. ./configure && egrep 'BUG_(CFLAGS|LIBS)' config.log
Removing aclocal.m4
Removing autom4te.cache/
Removing config.log
Removing configure
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: configure.ac: not using Automake
autoreconf: Leaving directory `.'
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for BUG... yes
0
ac_cv_env_BUG_CFLAGS_set=
ac_cv_env_BUG_CFLAGS_value=
ac_cv_env_BUG_LIBS_set=
ac_cv_env_BUG_LIBS_value=
pkg_cv_BUG_CFLAGS=
pkg_cv_BUG_LIBS=
BUG_CFLAGS=''
BUG_LIBS=''


So versioned dependencies not detected, while:
---
PKG_CONFIG_PATH=. pkg-config --cflags buga; echo $?
Package 'buga' requires 'bugb >= 42' but version of bugb is 1
1


Is that only about versioned dependencies? No. Tweak the Requires line of buga.pc so that it looks like that instead:
---
Name: buga
Description: Bug testcase A
Version: 1
Requires: bugc


And now, running autoreconf -vfi && ./configure again leads to the same issue as before.

Wild guess, that macro uses --exists, which works, but then --cflags and --libs fail. And tada, pkg.m4 agrees, pkg-config is called with: --exists --print-errors; and dependencies aren't checked.
Comment 1 Tollef Fog Heen 2011-04-13 12:49:53 UTC
Fixed in:

commit 4366f5842fc6ca0432c5dfa6b6dcb20d83aa4ee8
Author: Tollef Fog Heen <tfheen@err.no>
Date:   Wed Apr 13 21:45:57 2011 +0200

    Handle --exist working and --cflags or --libs failing
    
    --exists no longer does a full depth traversal, which means we need to
    pay attention to the exit status when calling pkg-config --libs and
    --cflags.  If those fail, we run with --cflags and --libs to get the
    error message before printing it out.
    
    Fixes Freedesktop #36039
Comment 2 Tollef Fog Heen 2011-04-13 13:04:33 UTC
*** Bug 30937 has been marked as a duplicate of this bug. ***
Comment 3 Tollef Fog Heen 2011-04-13 13:07:44 UTC
*** Bug 29736 has been marked as a duplicate of this bug. ***
Comment 4 Dan Nicholson 2013-05-19 02:29:40 UTC
*** Bug 64674 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.