- Linux Mint Forums
- Installing GTK
- Setting up GTK for GNU/Linux and Unix
- Stable version
- Building from source
- Installing GTK from packages
- Development version
- Older Versions
- Installing GTK3 from packages
- GTK v3.x
- Linux Mint Forums
- Help Installing GTK+3.2230
- Re: Help Installing GTK+3.2230
- Re: Help Installing GTK+3.2230
- Re: Help Installing GTK+3.2230
- Re: Help Installing GTK+3.2230
- Re: Help Installing GTK+3.2230
- Re: Help Installing GTK+3.2230
- Linux Mint Forums
- GTK installation
- Re: GTK installation
Linux Mint Forums
Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.
Installing GTK
Post by progproj » Sat Dec 08, 2018 10:27 pm
I am a Linux newbie. I am running Mint and I want to develop GTK programs using C. I will need both GTK+2.0 and 3.0 to link to.
I am not sure if GTK is installed on my system. I have the headers but I don’t see either the .c files or the object files.
I am completely new to Linux and I am not sure if every Linux install off the Debain branch already comes with GTK source and binaries installed or not. using locate I am able to find the .h files but scouring my computer, I don’t find the .c or the binaries.
Issuing pkg-config —cflags gtk+-2.0 at the command line, I get back the following:
-pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2
Going to these places, I find GTK .h files but no binaries. This seems strange to me. First, I can’t recall if I used Synaptic Package Manager to download GTK files or not (unfortunately!) . I am now wondering if Mint just installs them in these places.
Does Mint use GTK for its own purposes and if so does that intersect with my development environment- for example should I just reuse the ones Mint comes with?
Either way, whether I retrieved them or Mint came with them I can’t imagine how I ended up with just .h files. It feels wrong to me. I need the object files to link to , no?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Setting up GTK for GNU/Linux and Unix
In order to install GTK for GNU/Linux and Unix systems, you will need to get the GLib, GObject-Introspection, Pango, Gdk-Pixbuf, ATK and GTK packages to build GTK. To read more about these packages, please refer to the Architecture.
Stable version
To build an environment for GTK, install all the dependencies listed below:
Dependency | Source |
---|---|
GTK | |
GLib | |
Pango | |
Gdk-pixbuf | |
ATK | |
GObject-Introspection | |
Epoxy |
The current stable API version of GTK is 4.0.
Building from source
For additional help, the frequently asked questions page is a good starting point.
Installing GTK from packages
Distribution | Binary package | Development package | Additional packages |
---|---|---|---|
Arch | gtk4 | — | — |
Debian/Ubuntu | libgtk-4-1 | libgtk-4-dev | gtk-4-examples |
Fedora | gtk4 | gtk4-devel | — |
Development version
To build the latest development version of GTK you can use a tool like JHBuild, or you can rely on meson which will download and build many of the required dependencies as subprojects, if they are not available on your system.
Older Versions
Many applications still use GTK 3, an older stable version of GTK. You can have the run-time and development environments for GTK 4.x and GTK 3.x installed simultaneously on your computer.
Installing GTK3 from packages
Distribution | Binary package | Development package | Additional packages |
---|---|---|---|
Arch | gtk3 | — | — |
Debian/Ubuntu | libgtk-3-0 | libgtk-3-dev | gtk-3-examples |
Fedora | gtk3 | gtk3-devel | — |
GTK v3.x
Observed a typo or some missing information, edit this page.
Read on how to contribute to this website.
© 1997-2023, The GTK Team. All Rights Reserved.
Linux Mint Forums
Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.
Help Installing GTK+3.2230
Post by oscarTheGrouch » Mon Jun 11, 2018 11:31 pm
Hello all,
I’m trying to install the latest version of GTK but it’s seem beyond my Linux expertise.
The web sit list these requirements ..
You will need to get the GLib, GObject-Introspection, Pango, Gdk-Pixbuf, ATK and GTK+ packages to build GTK+.
You may also need some of the external dependencies that are also linked for each version listed below.
I downloaded the tar file and extracted it to a folder (gtk+-3.22.30). The documentation says to start with running the script file «configure which you then run to take the template makefiles called Makefile.in in the package and create makefiles customized for your operating system.»
I did this and get the following config errors ..
No package ‘glib-2.0’ found
No package ‘atk’ found
No package ‘pango’ found
No package ‘cairo’ found
No package ‘cairo-gobject’ found
No package ‘gdk-pixbuf-2.0’ found
I’m kinda stuck at this point and don’t know how to get these packages or install them.
Any help would be appreciated.
Thanks,
OtG
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Help Installing GTK+3.2230
Post by xenopeek » Mon Jun 11, 2018 11:43 pm
This will break Linux Mint 17.x and 18.x. Linux Mint 19 comes with Gtk+ 3.22. So before you waste a lot of time, why do you want this Gtk version? On Linux Mint 18.3 you can use Flatpak to install newer version of Gnome programs, if that is what you want to ultimately use this for. Look to the program you want if they have a Flatpak for it.
As for the not found errors, you’re required to install the development packages of those libraries. But answer first why you need to as proceeding with this on Linux Mint 17.x or 18.x will cause system breakage.
Re: Help Installing GTK+3.2230
Post by oscarTheGrouch » Tue Jun 12, 2018 12:05 am
Thank you for the reply.
«Linux Mint 19 comes with Gtk+ 3.22. So before you waste a lot of time, why do you want this Gtk version?»
I’m not stuck on using a certain version of GTK, just wanted to try and write some GUI programs using Netbeans and GTK looked like a good way to do that.
I am using Linux Mint 18 ‘Sarah’. Would I have to reinstall Linux to get to 19?
Thamks,
OtG
Re: Help Installing GTK+3.2230
Post by xenopeek » Tue Jun 12, 2018 1:49 am
After the final release of Linux Mint 19 is out, an upgrade path will open in Update Manager for upgrading in place (expected in 3-4 weeks). It will be announced on https://blog.linuxmint.com/.
That said, you don’t need Gtk 3.22 to be able to program Gtk 3. Linux Mint 18.x come with Gtk 3.18 so you could start with that. But I can understand wanting to use Gtk 3.22. In any case, while there are ways to install Gtk 3.22 on Linux Mint 18.x it will break any program that relies on Gtk 3.18 in a way that is incompatible with Gtk 3.22. Cinnamon needs adjustments to work with that Gtk version AFAIK. Which is why the new version of Cinnamon comes with Linux Mint 19.
What programming language will you be using? I’d perhaps start getting familiar with basic Gtk programming and move to Linux Mint 19 for Gtk 3.22 as your next developer base.
Re: Help Installing GTK+3.2230
Post by JosephM » Tue Jun 12, 2018 3:09 am
As xenopeek said you don’t need to build gtk to write applications with it. You will likely need to install the -dev packages to build your gtk apps. There are some good tutorials around on the web for getting started with gtk programming depending on the language you are using.
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.
Re: Help Installing GTK+3.2230
Post by oscarTheGrouch » Wed Jun 13, 2018 12:10 am
xenopeek wrote: ⤴ Tue Jun 12, 2018 1:49 am After the final release of Linux Mint 19 is out, an upgrade path will open in Update Manager for upgrading in place (expected in 3-4 weeks). It will be announced on https://blog.linuxmint.com/.
xenopeek wrote: ⤴ Tue Jun 12, 2018 1:49 am Linux Mint 18.x come with Gtk 3.18 so you could start with that. But I can understand wanting to use Gtk 3.22. In any case, while there are ways to install Gtk 3.22 on Linux Mint 18.x it will break any program that relies on Gtk 3.18 in a way that is incompatible with Gtk 3.22. Cinnamon needs adjustments to work with that Gtk version AFAIK. Which is why the new version of Cinnamon comes with Linux Mint 19.
I’ve tried 3.18 and can’t seem to make any sense of it. Documentation that I have found is Greek to me. I’ll wait on Mint 19. Is Update Manager going to update my ‘Sarah’ version??
xenopeek wrote: ⤴ Tue Jun 12, 2018 1:49 am What programming language will you be using? I’d perhaps start getting familiar with basic Gtk programming and move to Linux Mint 19 for Gtk 3.22 as your next developer base.
Netbeans using C/C++. There is a GTK sample program but can’t get it to work without GTK installed. I’m in no rush so I will wait for Mint 19.
I’ve domne a lot of Microchip PIC programming (it uses a version of Netbeans) and I need a PC app to interface with a PIC project I’m working on.
Thanks for the help, I REALLY appreciate it.
OtG
Re: Help Installing GTK+3.2230
Post by xenopeek » Wed Jun 13, 2018 1:38 am
There will be a new option in the menu of Update Manager for upgrading. It will become available shortly after final release of Linux Mint 19 and will be announced on the blog.
As for the GTK sample programs, might you perhaps not have installed the development libraries like JosephM referred to? Like you need libgtk-3-dev package installed minimum to be able to compile programs using GTK.
- apt install devhelp libgtk-3-doc libglib2.0-doc libpango1.0-doc to get reference manuals for programming GTK, GLib and related libraries. You’ll find Devhelp in the Programming category of your menu where you can access all.
- apt install gtk-3-examples to get a bunch of example programs showcasing what you can do with GTK. Like gtk3-demo to see a list of examples with description and source code and a Run button to run each demo. And gtk3-widget-factory to get a nice window showing you all possible widget (UI elements) of GTK.
- apt install gnome-devel-docs to get more guides for programming GTK. You can then run any of the following commands to access the developer guides for your GTK version.
yelp /usr/share/help/C/accessibility-devel-guide yelp /usr/share/help/C/gnome-devel-demos yelp /usr/share/help/C/hig yelp /usr/share/help/C/optimization-guide yelp /usr/share/help/C/platform-overview yelp /usr/share/help/C/programming-guidelines
#!/bin/bash mkdir -p ~/.local/share/applications/ echo "gnome-devel-docs" echo ">>> Removing old files" rm -v ~/.local/share/applications/gnome-devel-docs-*.desktop echo ">>> Creating new files" dirs=( $(dpkg -L gnome-devel-docs | grep /usr/share/help/C/. | cut -d'/' -f1-6 | sort -u) ) for dir in "$"; do title=$(basename $ | sed -r 's/-/ /g; s/[a-z]*/\u&/g; s/Gnome|Hig/\U&/') echo -e "\tCreating file for ´$title´" cat >~/.local/share/applications/gnome-devel-docs-$(basename $).desktop Icon=devhelp Exec=yelp $ Terminal=false Categories=GNOME;GTK;Development; StartupNotify=true END done echo echo "gtk3" echo ">>> Removing old files" rm -v ~/.local/share/applications/gtk3-*.desktop echo ">>> Creating new files" files=( $(grep '^NoDisplay=true$' /usr/share/applications/gtk3-* | cut -d':' -f1) ) for file in "$"; do title=$(grep '^Name=' $ | sed -r 's/^Name=//') echo -e "\tCreating file for ´$title´" sed -r 's/^(NoDisplay=)true$/\1false/' "$file" > "$/.local/share/applications/$(basename "$")" done echo echo ">>> Done"
Linux Mint Forums
Forum rules
There are no such things as «stupid» questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.
GTK installation
Post by nejdetckenobi » Tue Aug 28, 2012 6:37 am
I wish to build basic GTK+ applications I use Geany as IDE, I tried to compile the famous «Hello World» but I couldn’t.
gcc -Wall -c "%f" `pkg-config --cflags gtk+-2.0`
gcc -Wall -o "%f" "%e" `pkg-config --libs gtk+-2.0`
"gtk/gtk.h: No such file or directory"
I’m bored at searching «how to install it», I tried many things, none of them worked. Can someone answer with a «How to» guide? Everyone says «change your build commands it’ll work», I already changed it. So no more «change your parameters» advice please. I wish to build an application that uses GTK+. Please explain, how to install gtk, its dependencies, how to link its libraries, and what actually must be my new compile parameters, step-by-step. Thanks in advance.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: GTK installation
Post by Lord_Eager » Tue Aug 28, 2012 7:02 am
sudo apt-get install libgtk2.0-dev