Could not find a required package in 'build-packages': libgtk-4

Hello,

I am struggling with this for the last few days. I am trying to build snap of application that use gtk-4. I have libgtk-4 and libgtk-4-dev installed on my machine and when I build manually the project with cmake it is fine. However when I run “snapcraft” with the following snapcraft.yaml I get the error:

... 
...
apps:
  myapp
    command: usr/bin/myapp
    extensions: 
      - gnome-3-38
    plugs:
      - desktop
      - gsettings
      - opengl
      - wayland
      - unity7
      - home
      - network
    


parts:
 myapp:
    plugin: cmake
    cmake-parameters:
      - -DCMAKE_INSTALL_PREFIX=/usr
    source: src
    source-type: local
    build-packages:
      - clang
      - cmake
      - pkg-config
      - libcairo2
      - libcairo2-dev
      - libgtest-dev
      - libgtk-4
      - libgtk-4-dev
...
...

I got the following error: Could not find a required package in 'build-packages': libgtk-4

Any suggestions what can be the issue here?

where did you get these libs, how did you install them ?

if they are not normal distro packages you should create a separate part that installs them into the build env in the same way you got them on your machine

… then add an “after” stanza to the “myapp” part to make sure it only runs after they have been installed by the other part …

Thanks for the explanation. I guess, will wait for the core22 then.