Kde-neon-6 extension snap: QT_QPA_PLATFORM overwritten

I’m in the process now of providing a snap with a Qt6 build of FreeCAD, using the kde-neon-6 extension: Qt 6 build via kde-neon-6 by furgo16 · Pull Request #179 · FreeCAD/FreeCAD-snap · GitHub

For context, one of FreeCAD’s dependencies, Coin3D, does not support Wayland. To overcome this, we set QT_QPA_PLATFORM=xcb in the environment section of FreeCAD’s snapcraft.yaml file. This has worked well over the years.

However, the new kde-neon-6-based snap seems to present an issue: at runtime, at least when running on a host with a Wayland session, QT_QPA_PLATFORM within the snap is being set to wayland-egl. And FreeCAD just crashes at some point when accessing any Coin3D functionality.

It seems something is overriding QT_QPA_PLATFORM=xcb declared in the environment section of FreeCAD’s snapcraft.yaml. Would someone know how could this happen? And if there is a workaround?

Thanks.

This likely comes from a desktop-launch command-chain script, did you check your snapcraft.yaml with snapcraft --expand-extensions to se the actual file the extension generates ?

1 Like

Where can I inspect the desktop-launch command-chain script (I presume from the kde-neon-6 extension)?

Thank you. I did, but I could not see the env variable being overriden. Here’s the output

$ snapcraft expand-extensions 
name: freecad
summary: An open source parametric 3D CAD modeler
description: |
  FreeCAD is a parametric 3D modeler. Parametric modeling
  allows you to easily modify your design by going back into
  your model history and changing its parameters. FreeCAD is
  open source (LGPL license) and completely modular, allowing
  for very advanced extension and customization.

  FreeCAD is multiplatfom, and reads and writes many open
  file formats such as STEP, IGES, STL and others.

  Commands:
        freecad:      Run FreeCAD
        freecad.cmd:  Run FreeCAD command line interface
        freecad.pip:  Install python packages for user (not system-wide).
                      E.g. `freecad.pip install py_slvs` for Assembly3.
base: core24
issues:
- https://github.com/FreeCAD/FreeCAD-snap/issues
license: LGPL-2.0-or-later
adopt-info: freecad
parts:
  stub-chown:
    plugin: meson
    source: $CRAFT_PROJECT_DIR/snap/local/stub-chown
    source-type: local
    build-packages:
    - meson
    meson-parameters:
    - --prefix=/usr
    build-environment:
    - PATH: $CRAFT_STAGE/usr/bin:/snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
    - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
    - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/mesa-2404/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
    - CMAKE_PREFIX_PATH: $CRAFT_STAGE:/snap/kde-qt6-core24-sdk/current:/snap/kf6-core24-sdk/current:/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
  snap-setup-mod:
    plugin: dump
    source: $CRAFT_PROJECT_DIR/snap/local/snap-setup-mod
    source-type: local
    organize:
      '*': usr/Mod/SnapSetup/
    build-environment:
    - PATH: $CRAFT_STAGE/usr/bin:/snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
    - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
    - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/mesa-2404/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
    - CMAKE_PREFIX_PATH: $CRAFT_STAGE:/snap/kde-qt6-core24-sdk/current:/snap/kf6-core24-sdk/current:/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
  freecad:
    plugin: cmake
    source: https://github.com/FreeCAD/FreeCAD.git
    cmake-parameters:
    - -DFREECAD_QT_VERSION=6
    - -DCMAKE_INSTALL_PREFIX=/usr
    - -DCMAKE_INSTALL_LIBDIR=lib
    - -DCMAKE_BUILD_TYPE=Release
    - -DPYTHON_EXECUTABLE=/usr/bin/python3
    - -DPYTHON_INCLUDE_DIR=/usr/include/python3.12
    - -DPYTHON_LIBRARY=/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libpython3.12.so
    - -DFREECAD_USE_PYBIND11=ON
    - -DFREECAD_USE_QT_FILEDIALOG=ON
    - -DBUILD_FLAT_MESH=ON
    build-snaps:
    - freecad-deps-core24/edge
    stage-snaps:
    - freecad-deps-core24/edge
    build-packages:
    - g++
    - git
    - libboost-all-dev
    - libsimage-dev
    - libspnav-dev
    - libeigen3-dev
    - libgts-bin
    - libgts-dev
    - libkdtree++-dev
    - libmedc-dev
    - libopencv-dev
    - libproj-dev
    - libx11-dev
    - libxerces-c-dev
    - libyaml-cpp-dev
    - swig
    - python3-dev
    - libcoin-dev
    - libvtk9-dev
    - libpyside6-dev
    - libshiboken6-dev
    - pybind11-dev
    - libfreeimage-dev
    - openscad
    - python3-pivy
    - python3-matplotlib
    stage-packages:
    - libaec0
    - libboost-filesystem1.74.0
    - libboost-program-options1.74.0
    - libboost-python1.74.0
    - libboost-regex1.74.0
    - libboost-system1.74.0
    - libboost-thread1.74.0
    - libboost-date-time1.74.0
    - libhdf5-openmpi-103-1t64
    - libhwloc15
    - libimath-3-1-29t64
    - libjxr0t64
    - libmedc11t64
    - libmed11
    - libopenexr-3-1-30
    - libopenmpi3t64
    - libpsm-infinipath1
    - libpython3.12
    - libpython3.12-minimal
    - libpython3.12-stdlib
    - libraw23t64
    - libspnav0
    - libsz2
    - libxerces-c3.2t64
    - libyaml-cpp0.8
    - python3-tk
    - python3-yaml
    - python3-scipy
    - python3-numpy
    - python3-matplotlib
    - python3-six
    - python3-packaging
    - python3-pyparsing
    - python3-setuptools-scm
    - python3-collada
    - python3-cycler
    - python3-dateutil
    - python3-git
    - python3-ply
    - python3-pivy
    - python3-pyside6.qtcore
    - python3-pyside6.qtgui
    - python3-pyside6.qtsvg
    - python3-pyside6.qtwidgets
    - python3-pyside6.qtnetwork
    - python3-pyside6.qtuitools
    - python3-requests
    - calculix-ccx
    - libcoin80t64
    - libfreeimage3
    - libtbb12
    - libvtk9.1t64
    - openscad
    override-build: |
      SHIBOKEN_BIN_PATH="/workspace/usr/bin/shiboken6"
      if [ ! -e $SHIBOKEN_BIN_PATH ]; then
        mkdir -p "$(dirname "${SHIBOKEN_BIN_PATH}")"
        ln -s /usr/bin/shiboken2 $SHIBOKEN_BIN_PATH
      fi
      craftctl default
      sed -i -E \
        "s|^Icon=(.*)|Icon=\${SNAP}/usr/share/icons/hicolor/scalable/apps/org.freecad.FreeCAD.svg|g" \
        $CRAFT_PART_INSTALL/usr/share/applications/org.freecad.FreeCAD.desktop
      if [ "$CRAFT_ARCH_BUILD_FOR" = amd64 ]; then
        ln -sf ../libpsm1/libpsm_infinipath.so.1.16  $CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libpsm_infinipath.so.1
      fi
      cd $CRAFT_PART_SRC
      version_major=$(grep "set(PACKAGE_VERSION_MAJOR" CMakeLists.txt | tr -d '()"' | cut -d" " -f2)
      version_minor=$(grep "set(PACKAGE_VERSION_MINOR" CMakeLists.txt | tr -d '()"' | cut -d" " -f2)
      git_hash=$(git rev-parse --short=8 HEAD)
      version="${version_major}.${version_minor}-g$git_hash"
      craftctl set version="$version"
    build-environment:
    - PATH: $CRAFT_STAGE/usr/bin:/snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
    - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
    - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/mesa-2404/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
    - CMAKE_PREFIX_PATH: $CRAFT_STAGE:/snap/kde-qt6-core24-sdk/current:/snap/kf6-core24-sdk/current:/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
  python-packages:
    plugin: python
    source: .
    source-type: local
    python-packages:
    - ifcopenshell
    - pip
    stage:
    - -pyvenv.cfg
    - -lib/python3.12/site-packages/scipy*
    - -lib/python3.12/site-packages/numpy*
    build-environment:
    - PATH: $CRAFT_STAGE/usr/bin:/snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
    - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
    - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/mesa-2404/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
    - CMAKE_PREFIX_PATH: $CRAFT_STAGE:/snap/kde-qt6-core24-sdk/current:/snap/kf6-core24-sdk/current:/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
  graphviz:
    plugin: nil
    build-packages:
    - graphviz
    stage-packages:
    - graphviz
    override-build: |
      # Disable dot configuration, there is another dot in the kde6-core24 snap
      # For some reason that's the one that's the one that's called
      # The config file seems to already exist, though, so let's keep the copy
      # operation
      # ${CRAFT_PART_INSTALL}/usr/bin/dot -c
      cp \
        /usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/graphviz/config* \
        ${CRAFT_PART_INSTALL}/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/graphviz/
    build-environment:
    - PATH: $CRAFT_STAGE/usr/bin:/snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
    - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
    - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/mesa-2404/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
    - CMAKE_PREFIX_PATH: $CRAFT_STAGE:/snap/kde-qt6-core24-sdk/current:/snap/kf6-core24-sdk/current:/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
  cleanup:
    after:
    - stub-chown
    - freecad
    - python-packages
    - snap-setup-mod
    - graphviz
    plugin: nil
    build-snaps:
    - kf6-core24
    override-prime: |
      set -eux
      for snap in "kf6-core24"; do  # List all content-snaps you're using here
        cd "/snap/$snap/current" && \
        find . -type f,l \
        -not -path "./usr/lib/python3/dist-packages/*" \
        -not -name 'libblas.so*' \
        -not -name 'liblapack.so*' \
        -exec rm -f "$CRAFT_PRIME/{}" "$CRAFT_PRIME/usr/{}" \;
      done
      for cruft in bug lintian man; do
        rm -rf $CRAFT_PRIME/usr/share/$cruft
      done
      find $CRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -not -name 'ThirdPartyLibraries.html' -not -name 'LICENSE.html' -delete
      find $CRAFT_PRIME/usr/share -type d -empty -delete
      find $CRAFT_PRIME/usr/lib -type f,l \
        -name 'libQt*.so*' `# remove all Qt libs pulled in from Ubuntu repos` \
        -not -name 'libQt6Gamepad.so*' -delete `# for OpenSCAD`
    build-environment:
    - PATH: $CRAFT_STAGE/usr/bin:/snap/kde-qt6-core24-sdk/current/usr/bin:/snap/kf6-core24-sdk/current/usr/bin${PATH:+:$PATH}
    - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core24-sdk/current/usr/share:/snap/kf6-core24-sdk/current/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
    - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core24-sdk/current/etc/xdg:/snap/kf6-core24-sdk/current/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
    - LD_LIBRARY_PATH: /snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kde-qt6-core24-sdk/current/usr/lib:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/mesa-2404/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:/snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:/snap/kf6-core24-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:$CRAFT_STAGE/usr/lib:$CRAFT_STAGE/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
    - CMAKE_PREFIX_PATH: $CRAFT_STAGE:/snap/kde-qt6-core24-sdk/current:/snap/kf6-core24-sdk/current:/usr${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
  kde-neon-6/sdk:
    source: /snap/snapcraft/13879/share/snapcraft/extensions/desktop/command-chain-kde
    plugin: make
    build-snaps:
    - kde-qt6-core24-sdk
    - kf6-core24-sdk
    build-packages:
    - gettext
    - doxygen
    - graphviz
    - libxml2-utils
    - docbook-xml
    - docbook-xsl
    - libglx-dev
    - libgl-dev
    - libglvnd-dev
    make-parameters:
    - GPU_WRAPPER=gpu-2404-wrapper
    - PLATFORM_PLUG=kf6-core24
package-repositories:
- type: apt
  components:
  - main
  suites:
  - noble
  key-id: 444DABCF3667D0283F894EDDE6D4736255751E5D
  url: http://origin.archive.neon.kde.org/user
  key-server: keyserver.ubuntu.com
compression: lzo
donation:
- https://wiki.freecad.org/Donate
website:
- https://freecad.org
confinement: strict
layout:
  /usr/bin/mpirun:
    symlink: $SNAP/usr/bin/orterun
  /usr/share/openmpi:
    symlink: $SNAP/usr/share/openmpi
  /etc/openmpi:
    bind: $SNAP/etc/openmpi
  /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/openmpi:
    bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/openmpi
  /usr/bin/orted:
    symlink: $SNAP/usr/bin/orted
  /usr/share/pmix:
    symlink: $SNAP/usr/share/pmix
  /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pmix:
    symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pmix
  /etc/matplotlibrc:
    bind-file: $SNAP/etc/matplotlibrc
  /usr/share/matplotlib:
    symlink: $SNAP/usr/share/matplotlib
  /usr/bin/dot:
    symlink: $SNAP/usr/bin/dot
  /usr/bin/unflatten:
    symlink: $SNAP/usr/bin/unflatten
  /usr/share/povray-3.7:
    symlink: $SNAP/usr/share/povray-3.7
  /usr/share/X11:
    symlink: $SNAP/kf6/usr/share/X11
  /usr/share/qt6:
    symlink: $SNAP/kf6/usr/share/qt6
  /usr/share/libdrm:
    bind: $SNAP/gpu-2404/libdrm
  /usr/share/drirc.d:
    symlink: $SNAP/gpu-2404/drirc.d
grade: devel
assumes:
- snapd2.58.3
hooks:
  configure:
    command-chain:
    - snap/command-chain/hooks-configure-desktop
    plugs:
    - desktop
apps:
  freecad:
    command: usr/bin/FreeCAD
    common-id: org.freecad.FreeCAD.desktop
    desktop: usr/share/applications/org.freecad.FreeCAD.desktop
    plugs:
    - desktop
    - desktop-legacy
    - opengl
    - wayland
    - x11
    - audio-playback
    - unity7
    - network
    - network-bind
    - home
    - removable-media
    - gsettings
    - browser-support
    - cups
    - shared-memory
    command-chain:
    - snap/command-chain/gpu-2404-wrapper
    - snap/command-chain/desktop-launch
  cmd:
    command: usr/bin/FreeCADCmd
    plugs:
    - desktop
    - desktop-legacy
    - opengl
    - wayland
    - x11
    - audio-playback
    - unity7
    - network
    - network-bind
    - home
    - removable-media
    - gsettings
    - browser-support
    - cups
    - shared-memory
    command-chain:
    - snap/command-chain/gpu-2404-wrapper
    - snap/command-chain/desktop-launch
  pip:
    command: bin/pip
    plugs:
    - home
    - opengl
    - removable-media
    - gsettings
    - network
    - browser-support
    - unity7
    - cups
    - shared-memory
plugs:
  foo-install-cups:
    content: foo
    interface: content
    target: $SNAP_DATA/foo
    default-provider: cups
  shared-memory:
    private: true
  desktop:
    mount-host-font-cache: false
  gtk-2-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
  gtk-3-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes
  kf6-core24:
    content: kf6-core24-all
    interface: content
    target: $SNAP/kf6
    default-provider: kf6-core24
  gpu-2404:
    interface: content
    target: $SNAP/gpu-2404
    default-provider: mesa-2404
lint:
  ignore:
  - library
environment:
  LD_LIBRARY_PATH: $SNAP/usr/lib/:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/:$SNAP/kf6/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/:$SNAP/kf6/usr/lib:/$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack:$LD_LIBRARY_PATH
  LD_PRELOAD: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libstubchown.so
  FREECAD_USER_HOME: $SNAP_USER_COMMON
  GIT_EXEC_PATH: $SNAP/usr/lib/git-core
  GIT_TEMPLATE_DIR: $SNAP/usr/share/git-core/templates
  GIT_CONFIG_NOSYSTEM: '1'
  ELMER_HOME: $SNAP/usr
  PYTHONPYCACHEPREFIX: $SNAP_USER_COMMON/.pycache
  PYTHONUSERBASE: $SNAP_USER_COMMON/.local
  PIP_USER: '1'
  PYTHONPATH: $PYTHONUSERBASE/lib/python3.12/site-packages:$SNAP/lib/python3.12/site-packages:$SNAP/usr/lib/python3/dist-packages
  SNAP_PYTHONPATH: $PYTHONUSERBASE/lib/python3.12/site-packages:$SNAP/lib/python3.12/site-packages:$SNAP/usr/lib/python3/dist-packages
  QT_QPA_PLATFORM: xcb
  POVINI: $SNAP/etc/povray/3.7/povray.ini
  SNAP_DESKTOP_RUNTIME: $SNAP/kf6
  GTK_USE_PORTAL: '1'
  PLATFORM_PLUG: kf6-core24

Well, inside the kde-neon-6 extension…

I’m not sure where that is. I’m looking at:

And I can’t see anything obvious.

There’s layers and layers of repos. Finally I found this:

https://invent.kde.org/neon/snap-packaging/snapcraft-desktop-integration/-/tree/master?ref_type=heads

But it didn’t help either. The command-chain/desktop-launch file there points yet to another file ${SNAP}/kf6/snap/command-chain/desktop-launch6, but I cannot guess its location.

And down the rabbit hole I went:

git clone https://invent.kde.org/neon/snap-packaging/snapcraft-desktop-integration.git
cd snapcraft-desktop-integration
git checkout work.core24
cd kde-neon-6
PLATFORM_PLUG=kf6-core24 make build
cat desktop-launch6

In summary, desktop-launch6 is a generated file from the kf6-core24 platform (?) snap, which is a dependency from the kde-neon-6 extension.

The extension code is spread through several folders at GitHub - canonical/snapcraft: Package, distribute, and update any app for Linux and IoT.. The platform snap code is spread throuh several repositories at https://invent.kde.org/neon/snap-packaging/.

Once I generated the file, I could see that what I assume the proper way of not running on wayland on a snap is to declare:

environment:
  DISABLE_WAYLAND: 1

That works, although I’m still getting this warning when launching the snap:

Failed to create wl_display (No such file or directory)
1 Like

DISABLE_WAYLAND stops the Wayland socket from being created where it’s expected.

However, I don’t remember fully - but expect that DISABLE_WAYLAND doesn’t modify the $WAYLAND_DISPLAY variable itself at all, so your app will assume that there’s a socket to connect to and try do so, until it fails because the socket wasn’t created by the wrapper and the app falls back to X11.

Likely , you’d be better off having e.g.,

environment:
  WAYLAND_DISPLAY: unset

This will encourage your app to not attempt to connect to Wayland in the first place, rather than deny it and force a fallback should it try.

Otherwise the errors just noise really.

2 Likes