Core22 gnome extension and broken symlinks

Hi there, the fix will most likely be in 7.3.1.

I confirm and share the " Automatically rejected" revision tested with snapcraft 7.3

Revision #21

Recently I tried to make two libadwaita based apps, but both gave me this kind of error.

Failed to load shared library 'libpango-1.0.so.0' referenced by the typelib: /snap/metadata-cleaner/x2/gnome-platform/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: hb_ot_layout_get_horizontal_baseline_tag_for_script

The snapcraft.yaml for this is

snapcraft.yaml
name: metadata-cleaner # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '2.4.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: View and clean metadata in files # 79 char long summary
description: |
  Metadata within a file can tell a lot about you. Cameras record data about when and where a picture was taken and which camera was used. Office applications automatically add author and company information to documents and spreadsheets. This is sensitive information and you may not want to disclose it. This tool allows you to view metadata in your files and to get rid of it, as much as possible.
license: GPL-3.0+
architectures:
  - build-on: amd64

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
compression: lzo

layout:
  /usr/lib:
    bind: $SNAP/usr/lib
  /usr/share/locale:
    bind: $SNAP/usr/share/locale
  /usr/share/metadata-cleaner:
    bind: $SNAP/usr/share/metadata-cleaner

environment:
  # WORKAROUND: Add python modules in Snap to search path
  PYTHONPATH: ${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages

parts:
  mutagen:
    after: [ffmpeg]
    plugin: python
    source: https://github.com/quodlibet/mutagen.git
    source-tag: release-1.46.0
    source-type: git
    python-packages:
      - mat2
      - importlib-metadata
      - importlib-resources
      - PyGObject
    build-packages:
      - gir1.2-poppler-0.18
      - gir1.2-gdkpixbuf-2.0
      - libimage-exiftool-perl
    stage-packages:
      - libimage-exiftool-perl
      - gir1.2-gdkpixbuf-2.0
      - gir1.2-poppler-0.18
  ffmpeg:
    # WORKAROUND:
    # Build from source because the ffmpeg package installs libraries as dependencies
    # that conflict with the Gnome extension
    plugin: autotools
    source: https://ffmpeg.org/releases/ffmpeg-5.1.2.tar.xz
    source-checksum: sha256/619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc
    autotools-configure-parameters:
      # WORKAROUND: Install to /usr instead of /usr/local because it's not in search paths
      - --prefix=/usr
      - --disable-debug
      - --disable-doc
      - --disable-static
      - --enable-gpl
      - --enable-shared
      - --disable-ffplay
      - --disable-devices
      - --enable-gnutls
      - --enable-libmp3lame
      - --enable-libvorbis
    build-packages:
      - nasm
      - libgnutls28-dev
      - libmp3lame-dev
      - libvorbis-dev
    stage-packages:
      - libmp3lame0
    stage:
      - -usr/include
  metadata-cleaner:
    # See 'snapcraft plugins'
    plugin: meson
    after:
      - ffmpeg
    source: https://gitlab.com/rmnvgr/metadata-cleaner.git
    source-tag: v${SNAPCRAFT_PROJECT_VERSION}
    meson-parameters:
      - --prefix=/usr
    build-environment:
         # WORKAROUND: The python plugin is broken with gnome extension
         - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH}
         - PYTHONPATH: ""
    stage-packages:
      - perl
      - libpoppler118
      - libpoppler-glib8
      - libpng-tools
      - python3-gi-cairo
      - gir1.2-poppler-0.18
      - gir1.2-gdkpixbuf-2.0
      - gir1.2-rsvg-2.0
      - libimage-exiftool-perl
    override-pull: |
      craftctl default
      sed -e 's|Icon=fr.romainvigier.MetadataCleaner|Icon=usr/share/icons/hicolor/scalable/apps/fr.romainvigier.MetadataCleaner.svg|g' -i application/data/fr.romainvigier.MetadataCleaner.desktop.in
    override-stage: |
      craftctl default
      #sed -e 's|/usr/share/locale|/snap/metadata-cleaner/current/usr/share/locale|g' -i $SNAPCRAFT_STAGE/usr/bin/metadata-cleaner
      #sed -e 's|/usr/share/metadata-cleaner/data|/snap/metadata-cleaner/current/usr/share/metadata-cleaner/data|g' -i $SNAPCRAFT_STAGE/usr/bin/metadata-cleaner
      #sed -e 's|/usr/share/metadata-cleaner/src|/snap/metadata-cleaner/current/usr/share/metadata-cleaner/src|g' -i $SNAPCRAFT_STAGE/usr/bin/metadata-cleaner
      #mkdir -p gnome-platform/usr/lib/x86_64-linux-gnu/
      #ln -sf /snap/metadata-cleaner/current/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0.5000.6 $CRAFT_PART_INSTALL/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
  cleanup:
    after:  # Make this part run last; list all your other parts here
      - metadata-cleaner
      - ffmpeg
    plugin: nil
    build-snaps:  # List all content-snaps and base snaps you're using here
      - gnome-42-2204
      - gnome-42-2204-sdk
      - core22
    override-prime: |
      set -eux
      for snap in "core22" "gnome-42-2204" "gnome-42-2204-sdk"; do  # List all content-snaps and base snaps you're using here
        cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
      done
apps:
  metadata-cleaner:
    command: usr/bin/metadata-cleaner
    desktop: usr/share/applications/fr.romainvigier.MetadataCleaner.desktop
    extensions: [gnome]
    plugs:
      - home
    common-id: fr.romainvigier.MetadataCleaner
```

And this error I got in another one;

/snap/audio-sharing/x2/usr/bin/audio-sharing: symbol lookup error: /snap/audio-sharing/x2/gnome-platform/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: hb_ot_layout_get_horizontal_baseline_tag_for_script

The snapcraft.yaml file is

snapcraft.yaml

name: audio-sharing # you probably want to 'snapcraft register ’ base: core22 # the base snap is the execution environment for this snap version: ‘0.2.1’ # just for humans, typically ‘1.2+git’ or ‘1.3.2’ summary: Single-line elevator pitch for your amazing snap # 79 char long summary description: | This is my-snap’s description. You have a paragraph or two to tell the most important story about your snap. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the snap store. grade: devel # must be ‘stable’ to release into candidate/stable channels confinement: strict # use ‘strict’ once you have the right plugs and slots

slots: dbus-svc: interface: dbus bus: session name: de.haeckerfelix.AudioSharing

parts: rust: plugin: nil build-snaps: - rustup override-build: | rustup install stable audio-sharing: # See ‘snapcraft plugins’ after: [rust] plugin: meson source: https://gitlab.gnome.org/World/AudioSharing.git source-type: git source-tag: 0.2.1 meson-parameters: - --prefix=/usr build-packages: - libelf-dev - elfutils - libgstreamer1.0-dev stage-packages: - libgstreamer1.0-0 - libgstrtspserver-1.0-dev - libfreetype-dev - elfutils - libelf1 - libwebpmux3 override-prime: | craftctl default sed -e ‘s|Icon=de.haeckerfelix.AudioSharing|Icon=/usr/share/icons/hicolor/scalable/apps/de.haeckerfelix.AudioSharing|’ -i usr/share/applications/de.haeckerfelix.AudioSharing.desktop cleanup: after: # Make this part run last; list all your other parts here - audio-sharing - rust plugin: nil build-snaps: # List all content-snaps and base snaps you’re using here - gnome-42-2204 - gnome-42-2204-sdk - core22 override-prime: | set -eux for snap in “gnome-42-2204” “gnome-42-2204-sdk” “core22”; do cd “/snap/$snap/current” && find . -type f,l -exec rm -f “$SNAPCRAFT_PRIME/{}” ; done find $CRAFT_PRIME/usr/share/doc/ -type f -not -name ‘copyright’ -delete apps: audio-sharing: command: usr/bin/audio-sharing desktop: usr/share/applications/de.haeckerfelix.AudioSharing.desktop common-id: de.haeckerfelix.AudioSharing extensions: [gnome] plugs: - home - network - network-bind - mount-observe - network-manager slots: - dbus-svc

Are these errors for the same reason

Share my notes using snapcraft: Convenient ways to fix-up the missing library stage-packages prompt

We have a Snapcraft PR with the symlink fixes. With 45 files changed it’s not really trivial, so please test it when it lands on the edge channel.

1 Like

Tested snapcraft edge version with yt-dlg

➜ sudo snap refresh
➜ snapcraft --version
snapcraft 7.3
➜ sudo snap refresh --edge snapcraft
➜ snapcraft --version
snapcraft 7.3.post2+git11aaab5b
➜  snapcraft clean
➜ snapcraft --debug
➜ snapcraft upload --release=edge yt-dlg_1.8.5-0-g1c7dbf0_amd64.snap
Issues while processing snap:g
- package contains external symlinks: bin/python -> python3, bin/python3 -> /snap/gnome-42-2204-sdk/67/usr/bin/python3.10, bin/python3.10 -> python3
Full execution log: '/home/user/.local/state/snapcraft/log/snapcraft-20230228-092116.991674.log'

Keep getting external symlinks issue

That’s because the PR didn’t land yet, but it should work after it’s integrated and the new version is released to edge.

1 Like

This version work OK!

➜ sudo snap refresh
➜ snapcraft --version
snapcraft 7.3.1.post17+git8b3ed19b
➜ snapcraft clean
➜ snapcraft --debug
➜ snapcraft upload --release=edge yt-dlg_1.8.5-0-g1c7dbf0_amd64.snap
Revision 30 created for 'yt-dlg' and released to 'edge'
1 Like

The fix is now available in the stable release. It will be available in Snapcraft 7.4, for now it’s still available only in edge.

@tcab The workarounds for python3 + gnome extension may not be needed anymore with this new snapcraft release.

Is the stable release 7.3.1 without the suffix? because thats the latest version that snap refresh snapcraft gives me, and that’s the version that appears in my github action snapcore/action-build@v1 run.

I hope the answer is no, and there is another version coming, because 7.3.1 doesn’t fix my problem pushing to snapcraft store:

Status: processing
Status: error while processing
Issues while processing snap:
- package contains external symlinks: bin/python -> python3, bin/python3 -> /snap/gnome-42-2204-sdk/83/usr/bin/python3.10, bin/python3.10 -> python3

Using snapcraft from the edge channel You will need check the GitHub Actions update with the PR fix the issue

It should have been fixed in this release, could you post a copy of the yaml or the relevant parts so we can understand what’s happening?

My project is https://github.com/abulka/pynsource - a Python UML tool. The snapfile is https://github.com/abulka/pynsource/blob/master/snap/snapcraft.yaml

I tried snapcraft 7.3.1 and even 7.3.1.post20+git13719604 from edge - which build the snap ok but I still get the error trying to push to the store with snapcraft upload *.snap --release edge.

Interestingly a fork of my project with the @goldstar611 workarounds does publish to the store ok https://github.com/goldstar611/atestsnap

@tigarmo You may want to have a look at @tcab’s project above, where the Python interpreter from the gnome extension still seems to be causing problems.

The python fixes are only on edge, should be available in Snapcraft 7.4.0 once we tag it

Ah, that explains the situation. Updated my previous comment about availability.

I’ve just packed pynsource with Snapcraft 7.3.1.post21+gitfa823013 and workarounds commented out, and it seems that Python links are correct:

$ ls -l bin/python*
lrwxrwxrwx 1 claudio claudio  7 Mar 16 12:48 bin/python -> python3
lrwxrwxrwx 1 claudio claudio 19 Mar 16 12:48 bin/python3 -> /usr/bin/python3.10
lrwxrwxrwx 1 claudio claudio  7 Mar 16 12:48 bin/python3.10 -> python3

This is what I commented out:

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 28ee110..57f845d 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -36,9 +36,9 @@ apps:
       - network-bind
       - removable-media
 
-environment:
-  # WORKAROUND: Add python modules in Snap to search path
-  PYTHONPATH: ${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages
+#environment:
+#  # WORKAROUND: Add python modules in Snap to search path
+#  PYTHONPATH: ${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages
 
 parts:
   copy-stuff:
@@ -63,7 +63,7 @@ parts:
       # https://forum.snapcraft.io/t/python-plugin-gnome-3-extension-error/33396/8?u=oleksis
       # Seem to need this otherwise get ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
       - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH:+:$PATH}
-      - PYTHONPATH: /usr/lib/python310.zip:/usr/lib/python3.10:/usr/lib/python3.10/lib-dynload:/root/.local/lib/python3.10/site-packages:/usr/local/lib/python3.10/dist-packages:/usr/lib/python3/dist-packages:/root/project${PYTHONPATH:+:$PYTHONPATH}
+      #- PYTHONPATH: /usr/lib/python310.zip:/usr/lib/python3.10:/usr/lib/python3.10/lib-dynload:/root/.local/lib/python3.10/site-packages:/usr/local/lib/python3.10/dist-packages:/usr/lib/python3/dist-packages:/root/project${PYTHONPATH:+:$PYTHONPATH}
     build-packages:
       - freeglut3
       - freeglut3-dev

Updated snap manifest:

  • Comment PYTHONPATH environment variable
  • Install pip and update setuptools

For Build number 37

➜ sudo snap refresh
➜ snapcraft --version
snapcraft 7.3.1.post21+gitfa823013
➜ snapcraft clean
Cleaned build provider 
➜ snapcraft --debug
➜ unsquashfs yt-dlg_1.8.5-0-g1c7dbf0_amd64.snap
➜ ls -l squashfs-root/bin/python*
lrwxrwxrwx 1 oleksis oleksis  7 Mar 17 05:30 squashfs-root/bin/python -> python3
lrwxrwxrwx 1 oleksis oleksis 19 Mar 17 05:33 squashfs-root/bin/python3 -> /usr/bin/python3.10
lrwxrwxrwx 1 oleksis oleksis  7 Mar 17 05:30 squashfs-root/bin/python3.10 -> python3
➜ sudo snap install yt-dlg_1.8.5-0-g1c7dbf0_amd64.snap --dangerous
➜ snapcraft upload --release=edge yt-dlg_1.8.5-0-g1c7dbf0_amd64.snap
Revision 37 created for 'yt-dlg' and released to 'edge'  

Conected to to the repo the build number 38 failed to release. Is the lint warnings ?

I just tested my snap (Calaboka) built with snapcraft from latest edge as of now (7.3.1.post22+gitc64123e8). I can confirm that it builds and runs successfully. It looks like core22 + python + gnome finally work together! Thank you.

2 Likes