2

I'm trying to compile some Vala on ArchLinux, and when I try to include the package gtk+-3.0, it seems GDK and GTK+ 2.0 are being included as well; valac --pkg gtk+-3.0 test.vala gives the following errors:

gdk-2.0.vapi:8.3-8.28: error: `Gdk.Selection' already contains a definition for `convert'
    public static void convert (Gdk.Window requestor, Gdk.Atom selection,     Gdk.Atom target, uint32 time_);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
gdk-3.0.vapi:8.3-8.28: note: previous definition of `convert' was here
    public static void convert (Gdk.Window requestor, Gdk.Atom selection, Gdk.Atom target, uint32 time_);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
gdk-2.0.vapi:10.3-10.44: error: `Gdk.Selection' already contains a definition for `owner_get'
    public static unowned Gdk.Window owner_get (Gdk.Atom selection);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gdk-3.0.vapi:10.3-10.44: note: previous definition of `owner_get' was here
    public static unowned Gdk.Window owner_get (Gdk.Atom selection);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--snip--
Compilation failed: 942 error(s), 0 warning(s)

Is there some way of specifying not to include gtk+-2.0 or of making valac ignore these errors?

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
Kara Brightwell
  • 2,529
  • 1
  • 21
  • 29

2 Answers2

0

What version of vala? I fear it must be something messed up in your distribution. Can you paste the contents of /usr/share/.../gtk+-3.0.deps?

Also try using valac --verbose so that you see all the vapis being loaded. For each vapi, look the relative .deps file and check whether there is a gdk-2.0 lying around.

lethalman
  • 1,976
  • 1
  • 14
  • 18
  • It's Vala 0.12.1. Nothing looks unusual in /usr/share/vala-0.12/vapi/gtk+-3.0.deps: `gio-2.0 atk cairo gdk-pixbuf-2.0 gdk-3.0 pango` – Kara Brightwell Jun 19 '11 at 16:57
0

Without having access to your source code or build environment (assuming you're not merely typing the valac command directly), it's tough to troubleshoot this. Using a dead-simple test.vala with Vala 0.12.1, it builds fine on my system.

In the past I've seen bad Vala environments due to old versions of Vala (and its support files) lurking around. I recommend uninstalling Vala 0.12.1 completely, then going through /usr for any remnants. An easy and thorough way (although time-consuming) is to do this:

$ find /usr -name "*vala*"
$ find /usr -name "*.vapi"

Remove anything that's obviously not part of another package. (Note that some packages install their own VAPIs, like libgee.) Then reinstall Vala 0.12.1 and see if the problem persists.

Jim Nelson
  • 1,688
  • 3
  • 15
  • 27
  • When I tried this, vala left behind some vapis in /usr/share/vala (as opposed to /u/s/vala-0.12, which got removed). I deleted these and reinstalled vala, but the problem persists. I also tried vala from Git, version 0.14, but it still does it. Argh. – Kara Brightwell Jul 30 '11 at 22:51
  • 2
    I recently transitioned a project from GTK+2 to GTK+3 and had similar problems throughout the process. The reason: some of the other libraries our project depended on (such as libunique and WebKit) relied on GTK+2, which causes the conflict. Go through all the packages your app relies on and see if any of them depend on GTK+2. (Easiest way is to check their .deps file, i.e. unique-1.0.deps, which sits alongside their VAPI.) Then, you have to check if any of *those* packages rely on GTK+2, and so on. My guess is you'll find the culprit there. – Jim Nelson Jul 31 '11 at 02:27