How to use kde-frameworks-5-qt-5-15-3-core20-sdk to build my Qt snap?

I’m trying to use the kde-frameworks-5-qt-5-15-3-core20-sdk snap to build a Qt application, yuzu. Previously I’ve just used the Qt5 packages from the Ubuntu archives which has been working fine for me but recently I’ve decided to transition the snap to use Qt5 from a content snap, initially I’m trying to get the snap to work with the kde-frameworks-5 content snap via the kde-neon extension and ultimately to using my own recently created Qt5/KF5 content snap with the boilerplate yaml from the kde-neon extension (until hopefully the kde-neon extension provides a smoother experience). I’ve begun by specifying the kde-neon extension is to be used as well as including:

    build-snaps:
      - kde-frameworks-5-qt-5-15-3-core20-sdk/latest/candidate
      - kde-frameworks-5-qt-5-15-3-core20/latest/candidate

When I run the build I get the following cmake errors:

-- Configuring done
CMake Error at src/core/CMakeLists.txt:1 (add_library):
  Target "core" links to target "OpenSSL::SSL" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?


CMake Error at src/core/CMakeLists.txt:1 (add_library):
  Target "core" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/audio_core/CMakeLists.txt:1 (add_library):
  Target "audio_core" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/audio_core/CMakeLists.txt:1 (add_library):
  Target "audio_core" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at src/video_core/CMakeLists.txt:8 (add_library):
  Target "video_core" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/video_core/CMakeLists.txt:8 (add_library):
  Target "video_core" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at src/input_common/CMakeLists.txt:1 (add_library):
  Target "input_common" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/input_common/CMakeLists.txt:1 (add_library):
  Target "input_common" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at src/tests/CMakeLists.txt:1 (add_executable):
  Target "tests" links to target "OpenSSL::SSL" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?


CMake Error at src/tests/CMakeLists.txt:1 (add_executable):
  Target "tests" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/yuzu_cmd/CMakeLists.txt:14 (add_executable):
  Target "yuzu-cmd" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/yuzu_cmd/CMakeLists.txt:14 (add_executable):
  Target "yuzu-cmd" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/yuzu/CMakeLists.txt:13 (add_executable):
  Target "yuzu" links to target "OpenSSL::SSL" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?


CMake Error at src/yuzu/CMakeLists.txt:13 (add_executable):
  Target "yuzu" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/web_service/CMakeLists.txt:1 (add_library):
  Target "web_service" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/web_service/CMakeLists.txt:1 (add_library):
  Target "web_service" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at src/core/CMakeLists.txt:1 (add_library):
  Target "core" links to target "OpenSSL::SSL" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?


CMake Error at src/core/CMakeLists.txt:1 (add_library):
  Target "core" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/audio_core/CMakeLists.txt:1 (add_library):
  Target "audio_core" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/audio_core/CMakeLists.txt:1 (add_library):
  Target "audio_core" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at src/video_core/CMakeLists.txt:8 (add_library):
  Target "video_core" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/video_core/CMakeLists.txt:8 (add_library):
  Target "video_core" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at src/input_common/CMakeLists.txt:1 (add_library):
  Target "input_common" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/input_common/CMakeLists.txt:1 (add_library):
  Target "input_common" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at src/tests/CMakeLists.txt:1 (add_executable):
  Target "tests" links to target "OpenSSL::SSL" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?


CMake Error at src/tests/CMakeLists.txt:1 (add_executable):
  Target "tests" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/yuzu_cmd/CMakeLists.txt:14 (add_executable):
  Target "yuzu-cmd" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/yuzu_cmd/CMakeLists.txt:14 (add_executable):
  Target "yuzu-cmd" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Warning at src/yuzu/CMakeLists.txt:13 (add_executable):
  Cannot generate a safe runtime search path for target yuzu because files in
  some directories may conflict with libraries in implicit directories:

    runtime library [libopus.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /snap/kde-frameworks-5-qt-5-15-3-core20-sdk/current/usr/lib/x86_64-linux-gnu
    runtime library [libavcodec.so.58] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /snap/kde-frameworks-5-qt-5-15-3-core20-sdk/current/usr/lib/x86_64-linux-gnu
    runtime library [libavutil.so.56] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /snap/kde-frameworks-5-qt-5-15-3-core20-sdk/current/usr/lib/x86_64-linux-gnu
    runtime library [libswscale.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /snap/kde-frameworks-5-qt-5-15-3-core20-sdk/current/usr/lib/x86_64-linux-gnu

  Some of these libraries may not be found correctly.


CMake Error at src/yuzu/CMakeLists.txt:13 (add_executable):
  Target "yuzu" links to target "OpenSSL::SSL" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?


CMake Error at src/yuzu/CMakeLists.txt:13 (add_executable):
  Target "yuzu" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/web_service/CMakeLists.txt:1 (add_library):
  Target "web_service" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at src/web_service/CMakeLists.txt:1 (add_library):
  Target "web_service" links to target "OpenSSL::Crypto" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

My snapcraft.yaml contains:

name: yuzu
base: core20
version: '745'
summary: Nintendo Switch Emulator
description: ...
license: GPL-2.0
icon: snap/gui/yuzu.png
grade: stable
confinement: strict
architectures:
  - build-on: amd64
parts:
  yuzu:
    source: https://github.com/yuzu-emu/yuzu-mainline.git
    source-tag: mainline-0-$SNAPCRAFT_PROJECT_VERSION
    plugin: cmake
    cmake-parameters: 
    - -DCMAKE_BUILD_TYPE=Release
    - -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON
    - -DUSE_DISCORD_PRESENCE=ON
    - -DENABLE_QT_TRANSLATION=ON
    - -DYUZU_USE_QT_WEB_ENGINE=ON
    - -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"}
    - -DDISPLAY_VERSION=$SNAPCRAFT_PROJECT_VERSION
    - -DBUILD_TAG=mainline-$SNAPCRAFT_PROJECT_VERSION"
    - -DBUILD_REPOSITORY=yuzu-emu/yuzu-mainline"
    build-environment:
      - TITLEBARFORMATIDLE: "yuzu {}"
      - TITLEBARFORMATRUNNING: "yuzu {} | {}"
    cmake-generator: Ninja
    override-pull: |
      snapcraftctl pull
      git apply $SNAPCRAFT_STAGE/nodirtyversion.patch
    override-build: |
      if [ ! -f /usr/bin/lsb_release ]; then
        apt install -y lsb-release
      fi
      sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
      sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
      pip3 install conan
      snapcraftctl build
      sed -i 's|Icon=yuzu|Icon=/usr/local/share/icons/hicolor/scalable/apps/yuzu.svg|' $SNAPCRAFT_PART_INSTALL/usr/local/share/applications/yuzu.desktop
    build-snaps:
      - kde-frameworks-5-qt-5-15-3-core20-sdk/latest/candidate
      - kde-frameworks-5-qt-5-15-3-core20/latest/candidate
    build-packages:
    - cmake
    - ninja-build
    - build-essential
    - gcc-10
    - g++-10
    - python3-pip
    - sqlite3
    - libsqlite3-dev
    - python3-setuptools
    - libvulkan-dev
    - python
    - libfmt-dev
    - libzip-dev
    - liblz4-dev 
    - libmbedtls-dev
    - libssl-dev
    - libopus-dev
    - zlib1g-dev
    - libzstd-dev
    - libavcodec-dev
    - libavformat-dev
    - libavutil-dev
    - libswscale-dev
    - autotools-dev
    - automake
    - autoconf
    - libtool
    - libpulse-dev
    - libasound2
    - libhidapi-dev
    - libudev-dev
    # - glslang-tools
    stage-packages:
    # - libsdl2-2.0-0
    - libxi6
    - libxinerama1
    - libxrandr2
    - libvulkan1
    - mesa-vulkan-drivers
    - vulkan-utils
    - libzip5
    - libpulse0
    - libgl1-mesa-glx
    - libopus0
    - mesa-utils
    - xdg-utils
    - libswscale5
    - libavformat58
    - libavcodec58
    - libavutil56
    - libhidapi-libusb0
    - libhidapi-hidraw0
    - libasound2
    stage:
    - -usr/share/doc
    after:
    - patches
    - glslangvalidator
  glslangvalidator:
    plugin: nil
    source: https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip
    override-build: |
      cp -r $SNAPCRAFT_PART_BUILD/* /usr
    prime:
    - -*
  patches:
    plugin: dump
    source: snap/local/patches
    source-type: local
    prime:
      - -*
  launchers:
    plugin: dump
    source: snap/local/launchers
    source-type: local
    organize:
      '*': bin/
  glib2:
    plugin: nil
    stage-packages:
      - libglib2.0-0
    stage:
    - -usr/share/doc

layout:
  /usr/share/vulkan:
    symlink: $SNAP/usr/share/vulkan
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libvulkan_intel.so:
    symlink: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libvulkan_intel.so
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libvulkan_radeon.so:
    symlink: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libvulkan_radeon.so
  /usr/share/qt5:
    symlink: $SNAP/data-dir/kf5/usr/share/qt5
  /usr/share/libdrm:
    symlink: $SNAP/data-dir/kf5/usr/share/libdrm

apps:
  yuzu:
    command: usr/local/bin/yuzu
    command-chain:
    # - "bin/desktop-launch"
    - "bin/vulkan-icd-files"
    - "bin/yuzu-launch"
    extensions:
      - kde-neon
    desktop: usr/local/share/applications/yuzu.desktop
    environment:
      HOME: "$SNAP_USER_COMMON"
      LD_LIBRARY_PATH: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio"
      KDE_FORK_SLAVES: 1
      DISABLE_WAYLAND: 1
      PATH: "$PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libexec/kf5"
    plugs:
    - desktop
    - desktop-legacy
    - x11
    - wayland
    - audio-playback
    - opengl
    - joystick
    - unity7
    - network
    - network-bind
    - home
    - removable-media
    - gsettings
    - hardware-observe
    - mount-observe
    - bluez
    - browser-support
    - screen-inhibit-control
    - raw-usb
  yuzu-cmd:
    command: usr/local/bin/yuzu-cmd
    command-chain:
    - "bin/vulkan-icd-files"
    - "bin/yuzu-launch"
    environment:
      HOME: "$SNAP_USER_COMMON"
      LD_LIBRARY_PATH: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio"
      DISABLE_WAYLAND: 1 
    plugs:
    - x11
    - wayland
    - audio-playback
    - opengl
    - joystick
    - network
    - network-bind
    - home
    - removable-media
    - hardware-observe
    - mount-observe
    - bluez
    - browser-support
    - screen-inhibit-control
    - raw-usb

Can you try rebuilding after adding
pkg-config in your build-packages?

ref: https://stackoverflow.com/a/66883775

1 Like

I gave adding pkg-config a go despite the SDK already including pkg-config, it didn’t make any difference. I took a look at the kdenlive snapcraft yaml and found out it was setting the cmake parameter:

"-DCMAKE_FIND_ROOT_PATH=/usr\\;/root/stage\\;/snap/kde-frameworks-5-qt-5-15-3-core20-sdk/current"

The kde-neon extension already sets this parameter but it only sets up the root path to be the KDE SDK snap and not the /usr or $SNAPCRAFT_STAGE paths as set in the snippet above.

Once I added this to my snapcraft yaml it began to compile but failed to find X11/Xlib.h and GL/gl.h headers despite again being located in the SDK snap under usr/include. In order to get my snap to build I ended up having to add libx11-dev and libgl-dev to my build-packages but again I don’t think this should be necessary.

The final snap I built is experiencing issues in connecting the kde-frameworks-5-plug

$ sudo snap connect yuzu:kde-frameworks-5-plug 
error: snap "snapd" has no "content" interface slots

The kde-frameworks-5-qt-5-15-3-core20 content snap is present on my system and snap interface content shows the content snap as available slots:

slots:
  - gtk-common-themes:gtk-2-themes
  - gtk-common-themes:gtk-3-themes
  - gtk-common-themes:icon-themes
  - gtk-common-themes:sound-themes
  - kde-frameworks-5-qt-5-15-3-core20:kde-frameworks-5-85-qt-5-15-core20
  - kde-frameworks-5-qt-5-15-3-core20:kde-frameworks-5-qt-5-15-3-core20-slot

snap version information:

snap    2.51.4
snapd   2.51.4
series  16
ubuntu  21.04
kernel  5.11.0-31-generic