I am trying to run the following classic core22
snap (Qt Debian packages + Qt Creator from source) on Ubuntu 20.04:
name: qtcreator
title: Qt Creator
base: core22
adopt-info: qtcreator
summary: Qt Creator
grade: stable
confinement: classic
parts:
# install mesa with 'no-patchelf' for DRI drivers
# https://forum.snapcraft.io/t/opengl-broken-in-classic-core20-snap-on-22-04/29401/2
mesa-patchelf:
plugin: nil
stage-packages:
- libgl1-mesa-dri
build-attributes:
- enable-patchelf
stage:
- -usr/lib/${CRAFT_ARCH_TRIPLET}/dri
mesa-no-patchelf:
plugin: nil
stage-packages:
- libgl1-mesa-dri
build-attributes:
- no-patchelf
stage:
- usr/lib/${CRAFT_ARCH_TRIPLET}/dri
qtcreator:
source: http://code.qt.io/qt-creator/qt-creator.git
source-tag: v10.0.0
source-depth: 1
parse-info: [usr/local/share/metainfo/org.qt-project.qtcreator.appdata.xml]
plugin: cmake
cmake-generator: Ninja
build-attributes:
- enable-patchelf
build-packages:
- qt6-base-dev
- qt6-base-private-dev
- qt6-wayland-dev
- qt6-declarative-dev
- libqt6core5compat6-dev
- libegl-dev
- libgl-dev
- libdw-dev
stage-packages:
- libqt6concurrent6
- libqt6core6
- libqt6printsupport6
- libqt6sql6
- libqt6test6
- libqt6widgets6
- libqt6xml6
- libqt6core5compat6
- qt6-qpa-plugins
- qt6-wayland
- libdw1
apps:
qtcreator:
command: usr/local/bin/qtcreator
common-id: org.qt-project.qtcreator.desktop
desktop: usr/local/share/applications/org.qt-project.qtcreator.desktop
environment:
LD_LIBRARY_PATH: ${SNAP}/usr/local/lib:${SNAP}/usr/lib/${CRAFT_ARCH_TRIPLET}
LIBGL_DRIVERS_PATH: ${SNAP}/usr/lib/${CRAFT_ARCH_TRIPLET}/dri
QT_QPA_PLATFORM: wayland;xcb
This will cause a symbol lookup error
in libpthread.so
:
/snap/qtcreator/x1/usr/local/bin/qtcreator: symbol lookup error: /lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE
Opening a shell inside the snap (snap run --shell qtcreator
) and checking the dynamic libraries:
$ lddtree /snap/qtcreator/x1/usr/local/bin/qtcreator
qtcreator => /snap/qtcreator/x1/usr/local/bin/qtcreator (interpreter => /snap/core22/current/lib64/ld-linux-x86-64.so.2)
[...]
libglib-2.0.so.0 => /snap/core22/current/lib/x86_64-linux-gnu/libglib-2.0.so.0
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
[...]
shows that while the snap uses its own libglib-2.0
, this one is referencing libraries (libpcre.so
, libpthread.so
) outside the snap.
It seems that patchelf is not properly setting the rpath for all libraries.