Conflict between gtk4.vapi and gtk3.vapi

Hello everyone.
I apologize in advance if this message is posted in the wrong section, or it’s out of the scope of this forum.

I’m trying to develop my application (Akira) based on the GNOME 40 SDK in order to start upgrading the UI to Gtk4.
I’m currently on elementary OS 6 (based on Ubunut 20.04.2).
This is the YAML file I’m using: Akira/com.github.akiraux.akira.yml at gtk4_bonanza · akiraux/Akira · GitHub

The problem I’m encountering is that, after all the dependencies seem to build properly, I get these type of errors:
gtk4.vapi:14447.2-14447.47: error: Gtk' already contains a definition for tree_row_reference_inserted’
public static void tree_row_reference_inserted (GLib.Object proxy, Gtk.TreePath path);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gtk±3.0.vapi:13320.2-13320.47: note: previous definition of `tree_row_reference_inserted’ was here
public static void tree_row_reference_inserted (GLib.Object proxy, Gtk.TreePath path);

These errors are repeated for pretty much every Vala binding.
Do you know what might be the issue? Is my version of Vala too old? (0.48.*)
I also tried compiling the latest version of Vala in the flatpak but the issues remain.

Thanks for any help provided.

Hej,

you can’t depend on GTK3 and GTK4 at the same time since both provide the same symbols. You’ll have to remove the GTK3 dependency, add the GTK4 dependency and then port everything in one go.

Thank you so much for the reply.
I already removed the gtk3 dependencies from my meson file.
In which other locations should I update it?
Sorry if it’s a stupid question.

No worries :slight_smile:

If you’ve already removed the GTK3 dependency from your meson file some other library might be pulling GTK3 in (like libhandy, libdazzle etc.). You’ll have to remove the dependency on those too (and replace them with their GTK4 equivalents if possible, e.g. libadwaita instead of libhandy)

yup, you’re using libgranite which uses gtk3.

1 Like

You can use the following command to determine which dependency introduce gtk3:

meson introspect --dependencies <your-build-dir>

Great catch!
That was indeed the problem.
Thank you all for your help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.