JuliaGraphics / QML.jl

Build Qt6 QML interfaces for Julia programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QML rendering fails in snap confined environment

JanisErdmanis opened this issue · comments

One of the prerequisites to get an application into Snap Store is that it should use a snap confined environment and only use interfaces required for the application functionality. I have made some progress in running a QML application under the snap-confined environment, though with limited success so far.

I am linking the QML application to display drivers and libGL with the snap environment. I do this by using the mesa-core22 content environment library and setting __EGL_VENDOR_LIBRARY_DIRS, LIBGL_DRIVERS_PATH and LD_LIBRARY_PATH environment variables to link to a locally mounted libGL library location resulting in a following snap.yaml configuration:

name: qmlapp-strict
base: core22
version: '0.1.0'
summary: Summary of the app
description: Longer description of the app
grade: devel
confinement: strict

architectures:
- amd64

apps:
  qmlapp-strict:
    command: bin/qmlapp-strict
    desktop: meta/gui/qmlapp-strict.desktop
    plugs:
    - opengl
    - wayland
    - network
    - graphics-core22
    - desktop
    - x11

environment:
  __EGL_VENDOR_LIBRARY_DIRS: $SNAP/graphics/usr/share/glvnd/egl_vendor.d   
  LIBGL_DRIVERS_PATH: $SNAP/graphics/usr/lib/x86_64-linux-gnu/dri
  LD_LIBRARY_PATH: $SNAP/graphics/usr/lib/:$SNAP/graphics/usr/lib/x86_64-linux-gnu/
  PATH: $SNAP/bin/:$PATH
  QT_QPA_PLATFORM: xcb

plugs:
  graphics-core22:
    interface: content
    target: $SNAP/graphics
    default-provider: mesa-core22

layout:
  /usr/share/libdrm:
    bind: $SNAP/graphics/libdrm
  /usr/share/drirc.d:
    bind: $SNAP/graphics/drirc.d

The result is an application window which opens but does not draw any content shown on the left:

qmlapp-strict qmlapp-outside

The output of the session I get is:

Qt: Session management error: Could not open network socket
Qt Warning: Unrecognized OpenGL version ((null):0, (null))
Qt Warning: Unrecognized OpenGL version ((null):0, (null))
Qt Warning: Unrecognized OpenGL version ((null):0, (null))
Qt Warning: Unrecognized OpenGL version ((null):0, (null))
Qt Warning: Unrecognized OpenGL version ((null):0, (null))
Qt Warning: Unrecognized OpenGL version ((null):0, (null))

When running under Wayland with QT_QPA_PLATFORM=wayland, I get the same window but without warnings. On the right, I show how the application should look like started outside a confined environment using SNAP=. SNAP_USER_COMMON=. bin/qmlapp-strict from squashfs-root snap directory, which can be obtained from the snap with unsqaushfs.

The warnings led me to test whether OpenGL actually works. I tested that by bundling a simple window with GLAbstractions with the same setup, which draws everything as expected:

glapp-strict

Thus, it looks like the issue is on the QML side, and I have no clue how to proceed to resolve it.

The snap is around 200 MB large, available for download from here or can be generated with AppBundler.jl by running examples/qmlapp-strict/meta/build.jl build script.

Interesting idea! Would be nice if we could make it work, but I know that snap store is quite restrictive.