Re: [Vala] VAPI Generation Problems



Hello Andrew,

You have more than one problem here, see below

2011/10/10 Andrew Higginson <at higginson gmail com>:
My Gio-2.0.gir file is available here, and it is the latest in Ubuntu
11.10 (libglib2.0 package version 2.30.0) :
   http://db.tt/e621C6EA

As far as I know, vapigen still cannot parse the gio gir correctly
(nor the gtk one). So you probably need to pass at least --pkg
gtk+-3.0 to vapigen.

I tried to use the --pkg switches on the command line, and simply used
all the packages that were listed in the Meta-3.0.gir file in the
<include tags. So I ran the following command:

vapigen --library libmutter --pkg atk --pkg clutter-1.0 --pkg cogl-1.0
--pkg glib-2.0 --pkg gmodule-2.0 --pkg gobject-2.0 --pkg gdk-3.0 --pkg
gdk-pixbuf-2.0 --pkg gio-2.0 --pkg gtk+-3.0 --pkg json-glib-1.0 --pkg
pango --pkg pangocairo --pkg cairo --pkg x11 /usr/share/gir-1.0/Meta-3.0.gir

You don't need to pass all these, --pkg gtk+-3.0 --pkg clutter-1.0
should be enough. However, this still doesn't solve the problem.

And again the libmutter.vapi file is empty :(

The problem here is that the Meta-3.0.gir incorrectly reports the
packages it provides (it reports gtk+-3.0 and clutter-1.0, where it
should report libmutter (or mutter-plugins, or both. I'm not sure)),
so it is ignored (since we've already included gtk and clutter). This
should be fixed in mutter. and btw, they don't include the headers
either, that should be fixed as well.

At this point, I get the following errors:


Meta-3.0.gir:1581.45-1581.45: error: The type name `X.KeySym' could not be found
        <type name="xlib.KeySym" c:type="KeySym"/>
                                            ^
Meta-3.0.gir:1584.49-1584.49: error: The type name `X.KeyCode' could
not be found
        <type name="xlib.KeyCode" c:type="KeyCode"/>
                                                ^

The problem here is that the vala bindings for x11 don't have KeySym
and KeyCode (they are replaced by ulong and uchar). The simplest way
is to skip MetaKeyBinding (assuming you don't need it). This is done
by creating a file Meta-3.0.metadata containing

KeyBinding skip

and pass the directory containing this file to vapigen using --metadatadir.

At this point, you have a non-empty libmutter.vapi (I didn't test it,
so not sure it works). There are still crtitical warning (that seem to
be related to the fact that cogl-pango is put in the same vapi as
cogl, but they're harmless afaict).

HTH,
Abderrahim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]