[solved] [gtk-rs] cannot build gtk-rs (3) example app

[solved info] in the docs, the latest version is not always at the top or bottom.

Hi.
Im trying out gtk-rs for the first time.
Trying out the example “basics”.
it wont build because the version of glib-2.0 is less than required.

“cargo:warning="pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.48" did not exit successfully: exit status: 1
error: could not find system library ‘glib-2.0’ required by the ‘glib-sys’ crate
— stderr Requested ‘glib-2.0 >= 2.48’ but version of GLib is 2.9.6”

error says glib version is less than the glib-2.0 required.
why does the request associate GLib with glib-2.0?
where does the request constraint come from? glib-sys?
are the constraints set by pkg-config flags? i havent modified the default flags, dont know how to.

have the latest glib (aka GLib) latest is 2.9.6 according to download.gnome.org/sources/glib.
installed the package libgtk-3-dev (libgtk-4-dev doesnt exist yet - edit: for MY distro (kubuntu)).

how to resolve this issue?
-#-

Latest GLib at this point is 2.72.1 and 2.9.6 is from 2006. Your version is simply too old.

1 Like

thanks for your reply.
so i checked again and saw that the list in the sources is in alphabetical not numerical order, and the latest is not at the bottom.
will install the latest version.

If you installed GTK via your package manager then you should also install GLib via the package manager. Should probably be called something like libglib2.0-dev.

If libgtk-4-dev does not exist then your distro is simply not shipping GTK4 yet and is too old for GTK4 development.

1 Like

thanks @sdroege
i installed from source, and it fixed the issue.
is glib2.0 not included with ‘libgtk-3-dev’?
perhaps my trying to install gtk-4 from source caused my issue? i gave up on that when it almost instantly became a wild goose chase of errors. then settled on having only gtk-3.

GLib is a separate library to Gtk, though your packager should be smart enough to automatically install it. If it didn’t, you should raise an issue with them.

1 Like

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