102

States here that the package gtk+-3.0 was not found:

karl@karl-ux303ln:~$ pkg-config --cflags gtk+-3.0
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found

However I apparantly have gtk3 installed:

karl@karl-ux303ln:~$ dpkg -l libgtk* | grep -e '^i' | grep -e 'libgtk-*[0-9]'
ii  libgtk-3-0:amd64                            3.14.15-0ubuntu1~14.04~ricotz1                              amd64        GTK+ graphical user interface library
ii  libgtk-3-bin                                3.14.15-0ubuntu1~14.04~ricotz1                              amd64        programs for the GTK+ graphical user interface library
ii  libgtk-3-common                             3.14.15-0ubuntu1~14.04~ricotz1                              all          common files for the GTK+ graphical user interface library
ii  libgtk2.0-0:amd64                           2.24.23-0ubuntu1.3                                          amd64        GTK+ graphical user interface library
ii  libgtk2.0-bin                               2.24.23-0ubuntu1.3                                          amd64        programs for the GTK+ graphical user interface library
ii  libgtk2.0-common                            2.24.23-0ubuntu1.3                                          all          common files for the GTK+ graphical user interface library

However I can't seem to find the file gtk+-3.0.pc:

karl@karl-ux303ln:~$ sudo find / -name "gtk+-3.0.pc"
karl@karl-ux303ln:~$ 

Any ideas? I'm trying to use cmake however it can't find gtk3.

2 Answers2

169

I only had the normal gtk3 files installed, not the developement files needed for cmake to make use of:

sudo apt-get install build-essential libgtk-3-dev
  • Note: this command currently installs version 3.18.9 for Xenial – Hee Jin May 02 '18 at 19:30
  • build-essential is already the newest version (12.4ubuntu1). libgtk-3-dev is already the newest version (3.22.30-1ubuntu1). 0 aktualizowanych, 0 nowo instalowanych, 0 usuwanych i 3 nieaktualizowanych. a@zelman:~$ pkg-config --modversion gtk Package gtk was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk' found – Adam Jun 02 '18 at 19:47
  • Similar error in compile geany-plugins solve with install: libwebkit2gtk-4.0-dev libgtk-3-dev libglib2.0-dev autogen autoconf libtool m4 automake pkg-config libtool intltool-debian – EsmaeelE Apr 08 '20 at 18:45
0

(please read the warnings at the end of this answer)

Sometimes it won't even be the list if it cannot be installed.

apt-cache search libgtk-3-dev

In which case I had to DOWNGRADE a package dependency, you do this by specifying a version number:

apt-get install <offending-package-name>=VERSION_NUMBER

For example, with my install it was:

apt-get install libatk-bridge2.0-0=2.34.1-3

after which...

apt-get install libgtk-3-dev

Will re-install any removed dependencies and successfully install libgtk-3-dev.

WARNING! WARNING! WARNING!

WARNING: Downgrades can be DANGEROUS. Be sure you do not pass any automatic install flags like --yes along with the command line, and ACTUALLY READ the list of packages that will be installed/replaced/removed to ensure nothing IMPORTANT is in there. For example, if you see that 'ubuntustudio-*' is going to be removed, that might be a red flag if you use ubuntu studio. You do not want to inadvertently uninstall your core environment files.

What you really want to watch is the dependency chain. Be sure all dependencies are not depended upon nor have any requirements by other critical operating system components!