2

I'm running Ubuntu 18.04.4 LTS

When running

pkg-config --cflags gtk+-3.0 I get the following error -

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

I've tried installing missing packages (sudo apt-get install build-essential libgtk-3-dev ), as per pkg-config not finding gtk+-3.0, however when running

dpkg -l libgtk* | grep -e '^i' | grep -e 'libgtk-*[0-9]' I still get zsh: no matches found: libgtk* with the same error still happening.

I'm unable to download certain go packages due to this issue - does anyone have any ideas?

N0rbert
  • 99,918
  • To make your last command work the way you expect in zsh, either quote libgtk* or use setopt nonomatch – steeldriver Jul 15 '21 at 21:57
  • Thanks, I now get zsh: no matches found: libgtk*, zsh: no matches found: libgtk-*[0-9] – Tom Yeoman Jul 16 '21 at 07:32
  • You are searching for wrong files, I think. You should search by dpkg -S gtk+-3.0.pc and pkg-config --cflags gtk+-3.0 . Also I have a question - why do you run 18.04.4 instead of 18.04.5? You are probably missing major system upgrades by doing so. – N0rbert Jul 16 '21 at 07:50
  • @TomYeoman that sounds like you unquoted 'libgtk-*[0-9]' instead of quoted 'libgtk*' – steeldriver Jul 16 '21 at 13:18
  • I'm running ubuntu on WSL2, i'll look into upgrading :). I'm wondering if this could be part of my problem, as it's headerless? Thanks for the command @N0rbert I now get libgtk-3-dev:amd64: /usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-3.0.p returned – Tom Yeoman Jul 16 '21 at 13:54
  • I still however get the Package gtk+-3.0 was not found in the pkg-config search path. Perhaps you should add the directory containinggtk+-3.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk+-3.0' founderror message when runningpkg-config --cflags gtk+-3.0` – Tom Yeoman Jul 16 '21 at 13:55
  • So, after 18 hours, you really understood that mention of WSL maybe helpful. Great! In any way output of pkg-config --list-all --debug may help. – N0rbert Jul 16 '21 at 14:05

1 Answers1

3

Use search for gtk+-3.0.pc on https://packages.ubuntu.com and then execute

sudo apt-get install libgtk-3-dev

When all packages installed you can try to reinstall pkg-config, and then manually raise pkg-config trigger/hook by

sudo apt-get install --reinstall pkg-config
sudo /usr/share/pkg-config-dpkghook update

and then retry with

pkg-config --cflags gtk+-3.0
N0rbert
  • 99,918
  • Thanks. When running that I get libgtk-3-dev is already the newest version (3.22.30-1ubuntu4)., I had already run the command sudo apt-get install build-essential libgtk-3-dev as mentioned on the original post, so that would explain it? – Tom Yeoman Jul 16 '21 at 07:32
  • This is how this should work. You are probably have changed environment by Anaconda or something similar and gigantic. – N0rbert Jul 16 '21 at 07:53
  • @TomYeoman if you have manually deleted the .pc file you may need to reinstall the package (sudo apt install --reinstall libgtk-3-dev) – steeldriver Jul 16 '21 at 13:22
  • Thanks I've tried re-installing, and also ran dpkg -S gtk+-3.0.p to confirm it exists, I get the output libgtk-3-dev:amd64: /usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-3.0.pc. However running pkg-config --cflags gtk+-3.0 still returns 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

    Could it be that i'm running ubuntu in WSL2, which is heade less, and there's some sort of GUI requirement?

    – Tom Yeoman Jul 16 '21 at 13:58