Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Use of ffmpeg content snap #243

Open
soumyaDghosh opened this issue Oct 12, 2023 · 3 comments
Open

[Enhancement]: Use of ffmpeg content snap #243

soumyaDghosh opened this issue Oct 12, 2023 · 3 comments

Comments

@soumyaDghosh
Copy link
Member

soumyaDghosh commented Oct 12, 2023

What changes would you like?

Hii, @popey I just noticed you have forked this repo. I have a rough manifest of gimp, that uses ffmpeg-sdk and ffmpeg content snap. It'll reduce the workload on gimp. Can we use that? The logs of the snap made from the current manifest is given here.

Gtk-Message: 23:12:00.550: Failed to load module "gail"

** (gimp:17455): WARNING **: 23:12:00.556: (../atk-adaptor/bridge.c:1018):atk_bridge_adaptor_init: runtime check failed: (root)

(gimp:17455): GLib-GObject-CRITICAL **: 23:12:00.672: specified class size for type 'IBusIMContext' is smaller than the parent type's 'GtkIMContext' class size
malloc(): invalid size (unsorted)
Segmentation fault (core dumped)

Any extra information?

name: gimp
version: '2.10.34'
grade: stable
confinement: strict
base: core22
compression: lzo
icon: gimp.png
adopt-info: gimp
architectures:
  - build-on: amd64
  - build-on: arm64
  - build-on: armhf

layout:
  #/etc/gimp:
  #  bind: $SNAP/etc/gimp
  #/etc/ld.so.cache:
  #  bind-file: $SNAP_DATA/etc/ld.so.cache
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/babl-0.1:
    bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/babl-0.1
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gegl-0.4:
    bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gegl-0.4
  # /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/darktable:
  #   bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/darktable
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/evince/4/backends:
    bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/evince/4/backends
  #/usr/lib/gimp:
  #  bind: $SNAP/usr/lib/gimp
  /usr/lib/gvfs:
    bind: $SNAP/usr/lib/gvfs
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gvfs:
    bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gvfs
  /usr/libexec:
    bind: $SNAP/usr/libexec
  /usr/share/color:
    bind: $SNAP/usr/share/color
  # /usr/share/darktable:
  #   bind: $SNAP/usr/share/darktable
  /usr/share/ghostscript:
    bind: $SNAP/usr/share/ghostscript
  #/usr/share/gimp:
  #  bind: $SNAP/usr/share/gimp
  /usr/share/gvfs:
    bind: $SNAP/usr/share/gvfs
  /usr/share/iso-codes:
      bind: $SNAP/gnome-platform/usr/share/iso-codes
  /usr/share/lensfun:
    bind: $SNAP/usr/share/lensfun
  /usr/share/mypaint-data:
    bind: $SNAP/usr/share/mypaint-data
  /usr/share/xml/iso-codes:
    bind: $SNAP/gnome-platform/usr/share/xml/iso-codes

  # color-profiles:
  #   interface: system-files
  #   read:
  #   - /usr/share/color/icc

slots:
  gimp:
    interface: dbus
    bus: session
    name: org.gimp.GIMP.UI

plugs:
  ffmpeg-2204:
    interface: content
    target: $SNAP/ffmpeg-platform
    default-provider: ffmpeg-2204

environment:
  #SNAP_DESKTOP_RUNTIME: $SNAP/data-dir/gnome-platform
  GTK_EXE_PREFIX: $SNAP/usr
  GIMP2_LOCALEDIR: $SNAP/usr/share/locale
  LD_LIBRARY_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/babl-0.1:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/gegl-0.4:$SNAP/ffmpeg-platform/usr/lib/$CRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH
  #PYTHONPATH: $SNAP/usr/lib/python2.7:$SNAP/usr/lib/python2.7/site-packages:$PYTHONPATH
  FINAL_BINARY: $SNAP/usr/bin/gimp
  GTK_IM_MODULE_DIR: $SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET/gtk-2.0/2.10.0/immodules
  GTK3_IM_MODULE_DIR: $SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET/gtk-3.0/3.0.0/immodules

apps:
  gimp:
    command: usr/bin/gimp
    desktop: usr/share/applications/gimp.desktop
    extensions: [ gnome ]
    common-id: org.gimp.GIMP
    plugs:
      - cups-control
      - browser-support
      - home
      - network
      - opengl
      - removable-media
      - unity7

  # darktable:
  #   command: usr/bin/darktable
  #   command-chain: [snap/command-chain/desktop-launch]
  #   desktop: usr/share/applications/darktable.desktop
  #   common-id: darktable.desktop
  #   plugs:
  #   - cups-control
  #   - desktop
  #   - desktop-legacy
  #   - gsettings
  #   - home
  #   - network
  #   - opengl
  #   - removable-media
  #   - unity7
  #   - wayland
  #   - x11

parts:
  ffmpeg:
    plugin: nil
    build-snaps:
      - ffmpeg-2204-sdk
  # https://download.gimp.org/pub/gegl
  gegl:
    source: https://gitlab.gnome.org/GNOME/gegl.git
    source-tag: GEGL_0_4_44
    source-depth: 1
    plugin: meson
    meson-parameters:
      - --prefix=/usr
      - --buildtype=release
      - -Dworkshop=true
      - -Db_lto=true
      - -Ddocs=false
      - -Dintrospection=false
    build-environment:
      - to armhf:
        - CFLAGS: -Ofast -g -pipe -mfpu=neon
        - CXXFLAGS: -Ofast -g -pipe -mfpu=neon
        - LDFLAGS: -mfpu=neon
      - else:
        - CFLAGS: -Ofast -g -pipe
        - CXXFLAGS: -Ofast -g -pipe
      - GIO_MODULE_DIR: $CRAFT_STAGE/usr/lib/gio/modules
      - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/local/share:/usr/share
      - CPPFLAGS: -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_60
      - PKG_CONFIG_PATH: /snap/ffmpeg-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$PKG_CONFIG_PATH
    build-packages:
      - libexiv2-dev
      - libfftw3-dev
      - libgexiv2-dev
      - libglu1-mesa-dev
      - libgraphviz-dev
      - libgs-dev
      - liblensfun-dev
      - libluajit-5.1-dev
      - libmaxflow-dev
      - libopenexr-dev
      - libraw-dev
      - libsdl2-dev
      - libspiro-dev
      - libsuitesparse-dev
      - libtiff5-dev
      - libv4l-dev
    prime:
      - -usr/include
      - -usr/lib/pkgconfig

  # https://github.com/strukturag/libheif/releases
  libheif:
    #after: [libaom]
    source: https://github.com/strukturag/libheif.git
    source-tag: v1.16.2
    source-depth: 1
    plugin: cmake
    build-environment:
      - to armhf:
        # LTO fails on armhf
        - CFLAGS: -Ofast -g -pipe -mfpu=neon
        - CXXFLAGS: -Ofast -g -pipe -mfpu=neon
        - LDFLAGS: -mfpu=neon
        - PKG_CONFIG_PATH: /snap/ffmpeg-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$PKG_CONFIG_PATH
      - else:
        - CFLAGS: -Ofast -g -pipe -flto
        - CXXFLAGS: -Ofast -g -pipe -flto
        - LDFLAGS: -flto
        - PKG_CONFIG_PATH: /snap/ffmpeg-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$PKG_CONFIG_PATH
    cmake-parameters:
      - -DPREFIX=/usr
      - -DWITH_GDK_PIXBUF=OFF
      - -DCMAKE_LIBRARY_ARCHITECTURE=$CRAFT_ARCH_TRIPLET
      - -DPLUGIN_DIRECTORY=/usr/lib/$(DEB_HOST_MULTIARCH)/libheif/plugins
      - -DCMAKE_INSTALL_LIBDIR=/usr/lib/$CRAFT_ARCH_TRIPLET
    build-packages:
      - libde265-dev
      - libx265-dev
    prime:
      - -usr/include
      - -usr/lib/pkgconfig

  # https://github.com/Jehan/mypaint-brushes/releases

  # https://download.gimp.org/mirror/pub/gimp/v2.10/
  gimp:
    after:
      - gegl
      - libheif
    plugin: autotools
    source: https://gitlab.gnome.org/GNOME/gimp.git
    source-tag: GIMP_2_10_34
    source-depth: 1
    autotools-configure-parameters:
      - --prefix=/snap/gimp/current/usr
      - --sysconfdir=/snap/gimp/current/etc
      - --with-bug-report-url=https://github.com/snapcrafters/gimp/issues/
      - --with-build-id=org.gimp.GIMP.snapcraft.stable
      - --disable-check-update
      - --disable-docs
      - --disable-gtk-doc
      - --disable-gtk-doc-html
      - --disable-python
    build-environment:
      - to armhf:
        - CFLAGS: -Ofast -g -pipe -mfpu=neon -flto
        - CXXFLAGS: -Ofast -g -pipe -mfpu=neon -flto
        - LDFLAGS: -mfpu=neon -flto
        - PKG_CONFIG_PATH: /snap/ffmpeg-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$PKG_CONFIG_PATH
      - else:
        - CFLAGS: -Ofast -g -pipe -flto
        - CXXFLAGS: -Ofast -g -pipe -flto
        - LDFLAGS: -flto
        - PKG_CONFIG_PATH: /snap/ffmpeg-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$CRAFT_STAGE/usr/lib/pkgconfig:$PKG_CONFIG_PATH
      - GEGL_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET/gegl-0.4
      # the LD_LIBRARY_PATH is to fix configure failing to test for gegl matting-levin support
      - LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET:/snap/ffmpeg-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET
      - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/usr/local/share:/usr/share
      #- PYTHON: /usr/bin/python3.8
    #override-build: |
    #  rm -f $SNAPCRAFT_PART_INSTALL/usr/share/pkgconfig/iso-codes.pc
    #  snapcraftctl build
    #  sed -i -E "s|^(.*python3?=).*|\1/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/bin/python|" $CRAFT_PART_INSTALL/usr/lib/gimp/2.0/interpreters/pygimp.interp || true
    #  sed -i -E 's|^# \(mypaint-brush-path .*$|(mypaint-brush-path "/usr/share/mypaint-data/1.0/brushes:~/.mypaint/brushes")|' $SNAPCRAFT_PART_INSTALL/etc/gimp/2.0/gimprc
    build-packages:
      - glib-networking
      - gtk-doc-tools
      - libaom-dev
      - intltool
      - iso-codes
      - libaa1-dev
      - libart-2.0-dev
      - libbz2-dev
      - libexif-dev
      - libfftw3-dev
      - libgexiv2-dev
      - libgirepository1.0-dev
      - libgpm-dev
      - libgs-dev
      - libgtk2.0-dev
      - libgudev-1.0-dev
      - libice-dev
      - libisocodes-dev
      - liblcms2-dev
      - liblzma-dev
      - libmng-dev
      - libopenexr-dev
      - libopenjp2-7-dev
      - libslang2-dev
      - libsm-dev
      - libtiff5-dev
      - libwmf-dev
      - libxmu-dev
      - libxpm-dev
      - libxt-dev
      - xsltproc
      - libbabl-dev
      - libmypaint-dev
      - mypaint-brushes
    #- try:
    #  - libunwind-dev # not available in s390x

    #- try:
    # - libunwind8 # not available in s390x
    prime:
      - -snap/gimp
    organize:
      snap/gimp/current: .
    parse-info: [ usr/share/metainfo/org.gimp.GIMP.appdata.xml ]

  deps:
    plugin: nil
    stage-packages:
      - libamd2
      - libbtf1
      - libcamd2
      - libccolamd2
      - libcdt5
      - libcgraph6
      - libcholmod3
      - libcolamd2
      - libcxsparse3
      - libdav1d5
      - libde265-0
      - libexiv2-27
      - libgail-3-0
      - libgexiv2-2
      - libgraphblas6
      - libgs9
      - libgvc6-plugins-gtk
      - libgvpr2
      - libjpeg-turbo8
      - libklu1
      - liblab-gamut1
      - liblapack3
      - liblcms2-2
      - libldl2
      - liblensfun1
      - libluajit-5.1-2
      - libmaxflow0
      - libopenexr25
      - libpathplan4
      - libraw20
      - librbio2
      - libsdl2-2.0-0
      - libspiro1
      - libspqr2
      - libtiff5
      - libumfpack5
      - libxdot4
      - evince
      - ghostscript
      - gir1.2-babl-0.1
      - libaa1
      - libbabl-0.1-0
      - libart-2.0-2
      - libbz2-1.0
      - libexif12
      - libfftw3-3
      - libgpm2
      - libilmbase25
      - liblzma5
      - libmng2
      - libmypaint-1.5-1
      - libslang2
      - libwmf0.2-7
      - libxmu6
      - libxpm4
      - libxt6
      - mypaint-brushes
      - rawtherapee
  libavcodec:
    plugin: nil
    stage-packages:
      - libavcodec58
    prime:
      - usr/lib/*/libavcodec.so.58
      - usr/lib/*/libavcodec.so.58.134.100
@popey
Copy link
Contributor

popey commented Oct 12, 2023

I forked it to update in #242 which I don't know how to fix for arm64, sadly. If you want to switch to an ffmpeg content snap, feel free to do a PR, and someone might review it ;)

@soumyaDghosh soumyaDghosh mentioned this issue Oct 13, 2023
@popey
Copy link
Contributor

popey commented Oct 13, 2023

This builds okay for me, but fails to find x265 library and hangs.

/snap/gimp/current/usr/lib/gimp/2.0/plug-ins/file-heif/file-heif: error while loading shared libraries: libx265.so.199: cannot open shared object file: No such file or directory
/snap/gimp/x2/usr/bin/gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error

(gimp:962191): GLib-GObject-CRITICAL **: 14:57:51.814: specified class size for type 'IBusIMContext' is smaller than the parent type's 'GtkIMContext' class size
malloc(): invalid size (unsorted)

(script-fu:962654): LibGimpBase-WARNING **: 14:59:05.341: script-fu: gimp_wire_read(): error

@soumyaDghosh
Copy link
Member Author

This builds okay for me, but fails to find x265 library and hangs.

/snap/gimp/current/usr/lib/gimp/2.0/plug-ins/file-heif/file-heif: error while loading shared libraries: libx265.so.199: cannot open shared object file: No such file or directory
/snap/gimp/x2/usr/bin/gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error

(gimp:962191): GLib-GObject-CRITICAL **: 14:57:51.814: specified class size for type 'IBusIMContext' is smaller than the parent type's 'GtkIMContext' class size
malloc(): invalid size (unsorted)

(script-fu:962654): LibGimpBase-WARNING **: 14:59:05.341: script-fu: gimp_wire_read(): error

You need to connect to the ffmpeg content snap

snap connect gimp:ffmpeg-2204 ffmpeg-2204

The problem will be probably with the gail library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants