1

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?

7
  • To make your last command work the way you expect in zsh, either quote libgtk* or use setopt nonomatch Jul 15, 2021 at 21:57
  • Thanks, I now get zsh: no matches found: libgtk*, zsh: no matches found: libgtk-*[0-9]
    – Tom Yeoman
    Jul 16, 2021 at 7: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, 2021 at 7:50
  • @TomYeoman that sounds like you unquoted 'libgtk-*[0-9]' instead of quoted 'libgtk*' Jul 16, 2021 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, 2021 at 13:54

1 Answer 1

1

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
4
  • 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, 2021 at 7:32
  • This is how this should work. You are probably have changed environment by Anaconda or something similar and gigantic.
    – N0rbert
    Jul 16, 2021 at 7:53
  • @TomYeoman if you have manually deleted the .pc file you may need to reinstall the package (sudo apt install --reinstall libgtk-3-dev) Jul 16, 2021 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, 2021 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.