system popt

Dan Nicholson dbn.lists at gmail.com
Mon May 24 18:34:37 PDT 2010


On Mon, May 24, 2010 at 4:57 PM, Matthias Clasen <mclasen at redhat.com> wrote:
> On Mon, 2010-05-24 at 12:34 -0700, Dan Nicholson wrote:
>
>> Could you take a look in config.log to see exactly how pkg-config is
>> being invoked?
>
>
> configure:5761: found /usr/bin/pkg-config
> configure:5773: result: /usr/bin/pkg-config
> configure:5798: checking pkg-config is at least version 0.9.0
> configure:5801: result: yes
> configure:5812: checking for GCALCTOOL
> configure:5826: $PKG_CONFIG --exists --print-errors "
>    gtk+-2.0 >= $GTK_REQUIRED
>    gconf-2.0 >= $GCONF_REQUIRED
>    gio-2.0
>    libxml-2.0
>    gmodule-export-2.0
> "
> Couldn't parse Cflags field into an argument vector: missing argument
>
>
> Looks like removing --print-errors makes the parsing error go away.

Huh. Just tried it on F12 and it seems like the problem stems from
gio-2.0 for some reason.

$ pkg-config --exists --print-errors gio-2.0
$ echo $?
0
$ ./pkg-config --exists --print-errors gio-2.0
Couldn't parse Cflags field into an argument vector: missing argument
$ echo $?
1

And now looking at gio-2.0.pc, I see there's no argument for Cflags:

$ cat /usr/lib64/pkgconfig/gio-2.0.pc
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include

giomoduledir=${libdir}/gio/modules

Name: GIO
Description: glib I/O library
Version: 2.22.5
Requires: glib-2.0,gobject-2.0,gmodule-no-export-2.0
Libs: -L${libdir} -lgio-2.0
Cflags:

Trying it on another .pc file with empty Cflags:

$ ./pkg-config --exists --print-errors tic
Couldn't parse Cflags field into an argument vector: missing argument

So, the answer seems to be that we need to ignore error
POPT_ERROR_NOARG when parsing the fields since that's perfectly valid
for our use. I don't know why the ancient builtin popt doesn't throw
the same error.

This seems to work (you'll have to patch manually since gmail will
almost certainly mangle the whitespace):

diff --git a/parse.c b/parse.c
index c383c57..7e4f1e8 100644
--- a/parse.c
+++ b/parse.c
@@ -838,7 +838,7 @@ parse_cflags (Package *pkg, const char *str, const char *pat

   result = poptParseArgvString (trimmed, &argc, &argv);

-  if (result < 0)
+  if (result < 0 && result != POPT_ERROR_NOARG)
     {
       verbose_error ("Couldn't parse Cflags field into an argument vector: %s\n
                      poptStrerror (result));

$ ./pkg-config --exists --print-errors gio-2.0
$ echo $?
0

--
Dan


More information about the pkg-config mailing list