2

Ive been trying to install gtk version 4 on my debian system just to try it out but it seems extremely complicated. There is always some library or headerfile missing. On the official website there is no real installation instruction either. Can someone tell me how I can install GTK? seems impossible.

I have installed it with sudo apt install libgtk-4-dev.

however if I try to run the programm which is on the website of gtk I get the error:

gtk.h not found

  • Could you include a link to the program you’re trying to build, and show the commands you used to try to build it? – Stephen Kitt Mar 29 '23 at 17:00
  • Yes. the program is the one on their website: https://www.gtk.org/ , the C verison. I used gcc program.c -o program. Also I have tried to include the path /usr/linclude/gtk-4 with -I flag, but this doesn´t work either. Then I have tried to set the C_INCLUDE_PATH, without success, then I have tried to download the files from the installation site and compile them but just errors all over the place... – Kauabanga Mar 29 '23 at 17:25
  • That’s not the correct include path, see my updated answer. – Stephen Kitt Mar 29 '23 at 19:21
  • If you need a specialised build environment, or just want to try newer versions of stuff without risking your system then use a VM. That's one of the things they're for. e.g. create a VM and install Debian 12 (bookworm) on it. BTW, see Advice For New Users On Not Breaking Their Debian System – cas Mar 30 '23 at 02:33

2 Answers2

2

If you’re using Debian 11 or lower, there’s no easy way, but it’s not impossible.

(In Debian 12 or later, sudo apt install libgtk-4-dev.)

To build the example program, run

gcc $(pkg-config --cflags gtk4) program.c -o program $(pkg-config --libs gtk4)

If you’re contemplating building lots of dependencies, I would recommend trying to backport. For Debian 11, you would need to backport

and each of those may require further backports. All the other dependencies are already available in Debian 11.

You would also need to use meson and python3-gi from bullseye-backports.

Stephen Kitt
  • 434,908
0

The only way to install GTK-4 to Debian by building it and the dependencies from sources. The complete list of parts to build is:

  • GTK
  • GLib
  • Pango
  • Gdk-pixbuf
  • ATK
  • GObject-Introspection
  • Epoxy

Instructions and direct download links for sources are available in gtk.org documentation.

If you're unfamiliar with compiling and installing from sources, instructions and guides are easily found searching the web. Here's one example from itsfoss.com.

Peregrino69
  • 2,417
  • I just get errors when trying to follow the installation instrucitons provided on their website: collect2: error: ld returned 1 exit status – Kauabanga Mar 29 '23 at 16:21
  • You should edit your question to expand it. Put in what exactly you're doing (exact commands in code format), exact error messages. You can also upload the complete build output into Pastebin and add the link to the question. That way you can be helped to overcome problems. As is the question is simply impossible to answer well as "some library or headerfile" can refer to anything. Guessing games aren't usually very useful. – Peregrino69 Mar 29 '23 at 16:26