Support for GTK 3.24


#1

I would like to know if and how GTK 3.24 can be currently supported with Snap.

I already wrote about this topic in a previous thread about GWE, but I decided to create this specific thread to better track the issue.

I already tried to use gnome-3.30-1804 but, while I’m writing, is not working at all.

Does anyone know if a Snap app already managed to achieve this? Is it even achievable at the moment?


Help porting GWE (Nvidia info and overclock app) to Snap
#2

We have quite a few GNOME 3.30 snaps already, being built with the gnome-3-28-1804 platform snap. I suspect what you are really looking for is GTK 3.24, rather than GNOME 3.30. Is there anything else that you need a newer version that what’s provided in 18.04? Maybe dazzle, but that’s pretty trivial to build into your snap.


#3

Actually I’m not sure if what is needed is GTK or Gnome, what I know is that libdazzle shipped with Ubuntu 18.04 is not providing the needed method to add values to the model using Python introspection.

Maybe you are right and I just have to build libdazzle form the sources to get the version shipped with Gnome 3.30, but I have no idea how to do it with Snap.

If you have some time could you please give me some hints on what should I change in the snapcraft.yaml to achieve that?

EDIT
This how the flatpak’s libdazzle module of GWE looks: https://github.com/flathub/com.leinardi.gwe/blob/master/libdazzle.json


#4

So I’m trying with this:

  libdazzle:
    source: https://gitlab.gnome.org/GNOME/libdazzle.git
    source-commit: 4b8e745fc4c04e40f6355dfbc9689b6cb113496d
    plugin: meson
    meson-parameters:
      - --prefix=/snap/gwe/current/usr
    organize:
      snap/gwe/current/usr: usr
    build-packages:
      - build-essential
      - libgtk-3-dev

But looks like dazzle want GTK 3.24:

Dependency gtk+-3.0 found: NO found '3.22.30' but need: '>=3.24.0'
Found CMake: /usr/bin/cmake (3.10.2)
Dependency gtk+-3.0 found: NO (tried cmake)

src/meson.build:86:0: ERROR:  Invalid version of dependency, need 'gtk+-3.0' ['>=3.24.0'] found '3.22.30'.

#5

Ok, I’m trying to build the entire damn GTK 3.24 but, after building all the dependencies, it fails on building gtk:

git.mk: Generating .gitignore
  GEN      gtkresources.h
  GEN      gtkresources.c
gtk.gresource.xml: Child process killed by signal 11.
Makefile:8011: recipe for target 'gtkresources.c' failed
make[2]: *** [gtkresources.c] Error 1
make[2]: *** Waiting for unfinished jobs....
gtk.gresource.xml: Child process killed by signal 11.
Makefile:8008: recipe for target 'gtkresources.h' failed
make[2]: *** [gtkresources.h] Error 1
make[2]: Leaving directory '/root/parts/gtk/build/gtk'
Makefile:724: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/parts/gtk/build'
Makefile:618: recipe for target 'all' failed
make: *** [all] Error 2
Failed to run 'make -j2' for 'gtk': Exited with code 2.
Verify that the part is using the correct parameters and try again.
+ PKGCONFIG_BUILD=/root/stage/pkgconfig-build
+ mkdir -p /root/stage/pkgconfig-build
+ PCS=gdk-3.0.pc gdk-broadway-3.0.pc gdk-wayland-3.0.pc gdk-x11-3.0.pc gtk+-3.0.pc gtk+-broadway-3.0.pc gtk+-unix-print-3.0.pc gtk+-wayland-3.0.pc gtk+-x11-3.0.pc
+ gcc -print-multiarch
+ SRC=/root/parts/gtk/install/usr/lib/x86_64-linux-gnu/pkgconfig/gdk-3.0.pc
+ DST=/root/stage/pkgconfig-build/gdk-3.0.pc
+ cp /root/parts/gtk/install/usr/lib/x86_64-linux-gnu/pkgconfig/gdk-3.0.pc /root/stage/pkgconfig-build/gdk-3.0.pc
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i snapcraft snap' with 'multipass': returned exit code 2.

This is what I have added to my snapcraft.yaml:

magic:
    plugin: nil
    build-environment: &buildenv
      - PATH: $PATH:$SNAPCRAFT_STAGE/usr/bin
      - XDG_DATA_DIRS: $XDG_DATA_DIRS:$SNAPCRAFT_STAGE/usr/share:/usr/share
      - PKG_CONFIG_PATH: $SNAPCRAFT_STAGE/pkgconfig-build
      - ACLOCAL_PATH: $SNAPCRAFT_STAGE/usr/share/aclocal
      - GI_TYPELIB_PATH: $SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/girepository-1.0:/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/girepository-1.0
      - VAPIDIR: $SNAPCRAFT_STAGE/usr/share/vala/vapi:$SNAPCRAFT_STAGE/usr/share/vala-0.40/vapi:$SNAPCRAFT_STAGE/usr/share/vala-0.36/vapi:$SNAPCRAFT_STAGE/usr/share/vala-0.30/vapi
      - VALAFLAGS: " --vapidir $SNAPCRAFT_STAGE/usr/share/vala/vapi $SNAPCRAFT_STAGE/usr/share/vala-0.40/vapi $SNAPCRAFT_STAGE/usr/share/vala-0.36/vapi $SNAPCRAFT_STAGE/usr/share/vala-0.30/vapi"
      - LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAPCRAFT_STAGE/usr/lib/vala-0.40
      - CMAKE_PREFIX_PATH: $CMAKE_PREFIX_PATH:$SNAPCRAFT_STAGE
      - CMAKE_INCLUDE_PATH: $CMAKE_INCLUDE_PATH:$SNAPCRAFT_STAGE/include:$SNAPCRAFT_STAGE/usr/include
      - CMAKE_LIBRARY_PATH: $CMAKE_LIBRARY_PATH:$SNAPCRAFT_STAGE/lib:$SNAPCRAFT_STAGE/usr/lib:$SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET

  libdazzle:
    after: [gtk]
    source: https://gitlab.gnome.org/GNOME/libdazzle.git
    source-commit: 4b8e745fc4c04e40f6355dfbc9689b6cb113496d
    plugin: meson
    meson-parameters:
      - --prefix=/snap/gwe/current/usr
    organize:
      snap/gwe/current/usr: usr
    build-packages:
      - build-essential

  gtk:
    after: [glib, cairo, epoxy, pango, gobject-introspection, gdk-pixbuf, json-glib, atk, at-spi2-atk]
    source: https://gitlab.gnome.org/GNOME/gtk.git
    source-branch: gtk-3-24
    plugin: autotools
    configflags: [ --prefix=/usr, --disable-maintainer-mode, --enable-debug=no ]
    build-environment: *buildenv

    override-build: |
      set -eux
      sed -i 's#demos tests testsuite examples=#tests testsuite#' Makefile.am
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PCS="gdk-3.0.pc gdk-broadway-3.0.pc gdk-wayland-3.0.pc gdk-x11-3.0.pc gtk+-3.0.pc gtk+-broadway-3.0.pc gtk+-unix-print-3.0.pc gtk+-wayland-3.0.pc gtk+-x11-3.0.pc"
      for PC in $PCS
      do
        SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)/pkgconfig/$PC
        DST=$PKGCONFIG_BUILD/$PC
        cp $SRC $DST
        sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
        sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
      done
    build-packages:
      - libtool
      - gtk-doc-tools
      - gettext
      - dbus-x11
      - libegl1-mesa-dev
      - libwayland-dev
      - libxkbcommon-dev
      - libx11-dev
      - libxext-dev
      - libxi-dev
      - libxrandr-dev
      - libxt-dev
      - libxrender-dev
      - libxft-dev
      - libxcursor-dev
      - libxcomposite-dev
      - libxdamage-dev
      - libxkbfile-dev
      - libxinerama-dev
      - libxfixes-dev
      - x11proto-xext-dev
      - libcups2-dev
      - libcolord-dev
      - librest-dev
      - xvfb

  at-spi2-core:
    after: [glib, gobject-introspection]
    source: https://gitlab.gnome.org/GNOME/at-spi2-core.git
    source-tag: AT_SPI2_CORE_2_28_0
    plugin: meson
    meson-parameters: [ --prefix=/usr ]
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=atspi-2.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
      sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
    build-packages:
      - libdbus-1-dev
      - libxkbcommon-x11-dev
      - libxkbcommon-dev
      - libxtst-dev

  at-spi2-atk:
    after: [glib, at-spi2-core, atk]
    source: https://gitlab.gnome.org/GNOME/at-spi2-atk.git
    source-branch: gnome-3-26 # there is no gnome-3-28 branch yet
    plugin: meson
    meson-parameters: [ --prefix=/usr ]
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=atk-bridge-2.0.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
      sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
    build-packages:
      - libdbus-1-dev
      - libdbus-glib-1-dev
      - libxml2-dev
      - libx11-dev


  atk:
    after: [glib]
    source: https://gitlab.gnome.org/GNOME/atk.git
    source-branch: gnome-3-28
    plugin: autotools
    configflags: [ --prefix=/usr ]
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=atk.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
      sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST

  json-glib:
    after: [glib]
    source: https://gitlab.gnome.org/GNOME/json-glib.git
    source-branch: json-glib-1-4
    plugin: meson
    meson-parameters: [ --prefix=/usr ]
    build-environment: *buildenv

  pango:
    after: [glib, cairo, harfbuzz]
    source: https://gitlab.gnome.org/GNOME/pango.git
    #source-tag: '1.42.0'
    plugin: meson
    meson-parameters: [ --prefix=/usr ]
    build-environment: *buildenv
    build-packages:
      - libfreetype6-dev
      - libfontconfig1-dev
      - libx11-dev
      - libxft-dev
      - libxrender-dev
      - libxt-dev
      - libfribidi-dev
      - libthai-dev
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PCS="pango.pc pangocairo.pc pangoxft.pc pangoft2.pc"
      for PC in $PCS
      do
        SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)/pkgconfig/$PC
        DST=$PKGCONFIG_BUILD/$PC
        cp $SRC $DST
        sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
        sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
      done

  harfbuzz:
    after: [glib, cairo, gobject-introspection]
    source: git://anongit.freedesktop.org/git/harfbuzz
    source-tag: '1.7.6'
    plugin: autotools
    configflags:
      - --prefix=/usr
      - --with-graphite2=yes
      - --enable-introspection
      - --with-gobject
    build-environment: *buildenv
    build-packages:
      - libfreetype6-dev
      - libicu-dev
      - libgraphite2-dev
      - ragel
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=harfbuzz.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
      sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST

  gdk-pixbuf:
    after: [glib, gobject-introspection]
    source: https://gitlab.gnome.org/GNOME/gdk-pixbuf.git
    source-tag: 2.38.0 # there is no gdk-pixbuf-2-38 branch yet
    plugin: meson
    meson-parameters: [ --prefix=/usr ]
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=gdk-pixbuf-2.0.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
      sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
    build-packages:
      - libx11-dev
      - libpng-dev
      - libjpeg-dev
      - libtiff-dev

  gobject-introspection:
    after: [glib, cairo]
    source: https://gitlab.gnome.org/GNOME/gobject-introspection.git
    #source-branch: gnome-3-28
    plugin: autotools
    configflags: [ --prefix=/usr, --with-python=python3 ]
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      SCANNER=$SNAPCRAFT_PART_INSTALL/usr/bin/g-ir-scanner
      mkdir -p $SNAPCRAFT_STAGE/usr/bin
      cp $SCANNER $SNAPCRAFT_STAGE/usr/bin/g-ir-scanner.orig
      sed -i 's#/usr/lib#$SNAPCRAFT_STAGE/usr/lib#' $SCANNER
      sed -i 's#/usr/share#$SNAPCRAFT_STAGE/usr/share#' $SCANNER
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=gobject-introspection-1.0.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#^prefix=#prefix=$SNAPCRAFT_STAGE#' $DST
    build-packages:
      - python3-dev
      - libffi-dev
      - python3-mako
      - bison
      - flex

  cairo:
    after: [glib]
    source: git://anongit.freedesktop.org/git/cairo
    source-branch: '1.14'
    plugin: autotools
    configflags:
      - --prefix=/usr
      - --enable-pdf
      - --enable-ps
      - --enable-xlib
      - --enable-png
      - --enable-tee
      - --enable-svg
      - --enable-xcb
      - --enable-perf-utils
      - --disable-silent-rules
      - --disable-maintainer-mode
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PCS="cairo-fc.pc cairo-ft.pc cairo-gobject.pc cairo-pdf.pc cairo-png.pc cairo-ps.pc cairo-script.pc cairo-svg.pc cairo-tee.pc cairo-xcb-shm.pc cairo-xcb.pc cairo-xlib-xrender.pc cairo-xlib.pc cairo.pc"
      for PC in $PCS
      do
        SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/pkgconfig/$PC
        DST=$PKGCONFIG_BUILD/$PC
        cp $SRC $DST
        sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
        sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
      done
    build-packages:
      - libfontconfig1-dev
      - libfreetype6-dev
      - libxrender-dev
      - libx11-dev
      - libxext-dev
      - libpng-dev
      - libsm-dev
      - xutils-dev
      - libxt-dev
      - libpixman-1-dev
      - libxcb1-dev
      - libxcb-render0-dev
      - libxcb-shm0-dev
      - zlib1g-dev
      - liblzo2-dev

  epoxy:
    after: [glib]
    source: https://github.com/anholt/libepoxy.git
    plugin: meson
    meson-parameters: [ --prefix=/usr ]
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=epoxy.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
      sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
    build-packages:
      - xutils-dev
      - libx11-dev
      - libgl1-mesa-dev
      - libegl1-mesa-dev

  glib:
    source: https://gitlab.gnome.org/GNOME/glib.git
    source-branch: glib-2-58
    configflags: [ --prefix=/usr ]
    plugin: autotools
    build-environment: *buildenv
    override-build: |
      set -eux
      snapcraftctl build
      PKGCONFIG_BUILD=$SNAPCRAFT_STAGE/pkgconfig-build
      mkdir -p $PKGCONFIG_BUILD
      PC=glib-2.0.pc
      SRC=$SNAPCRAFT_PART_INSTALL/usr/lib/pkgconfig/$PC
      DST=$PKGCONFIG_BUILD/$PC
      cp $SRC $DST
      sed -i 's#libdir=#libdir=$SNAPCRAFT_STAGE#' $DST
      sed -i 's#includedir=#includedir=$SNAPCRAFT_STAGE#' $DST
    build-packages:
      - automake
      - autoconf
      - autotools-dev
      - libtool
      - libmount-dev

@kenvandine any suggestion?

snapcraft.yaml


#6

Let me work on it a bit more tomorrow. I had built gtk into your snap last week but I was having issues with two versions of GTK in the snap (one built from source and one from the bionic package).


#7

Hi @kenvandine, did you manage to make any progress?


#8

bump :upside_down_face:


#9

We have made some good progress. We’ve gotten gtk master to build in the gnome-3-28-1804-sdk build snap. This logic could be used in your snap, or perhaps we could get your snap building with the build-snap rather than build-packages. We’re actively working on finishing off the build-snap and I’ll keep you posted. If we don’t get anything soon, I’ll send you a patch which builds gtk as a part in your snap.