When I snap my current app it gives a warning about an empty LD_LIBRARY_PATH like the following:
Priming wickr
+ snapcraftctl prime
The 'passthrough' property is being used to propagate experimental properties to snap.yaml that have not been validated.
CVE-2020-27348: A potentially empty LD_LIBRARY_PATH has been set for environment in 'wickrproalpha'. The current working directory will be added to the library path if empty. This can cause unexpected libraries to be loaded.
Snapping |
Snapped wickrproalpha_6.17.1_amd64.snap
In my yaml I am trying to expose certain paths and key names but to no avail, like adding things to LD_LIBRARY_PATH. How do I do that? Currently in the process of updating my yaml for 20.04 from 18.04.
My current attempt:
apps:
WICKRLCAPPNAME:
environment:
DISABLE_WAYLAND: 1
QT_QPA_PLATFORMTHEME: gtk3
QT_BASE_DIR: /opt/qt51512
QTDIR: $QT_BASE_DIR
PATH: $QT_BASE_DIR/bin:$PATH
LD_LIBRARY_PATH: $QT_BASE_DIR/lib:$LD_LIBRARY_PATH
PKG_CONFIG_PATH: $QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
My whole yaml file that I am trying to get working for 20.04 (NEW):
name: WICKRLCAPPNAME
version: WICKRVERSIONNUM
summary: Secure Messaging for Teams
description: >
Wickr Secure Messaging
grade: stable
confinement: strict
base: core20
icon: snap/gui/WICKRLCAPPNAME.png
apps:
WICKRLCAPPNAME:
environment:
DISABLE_WAYLAND: 1
QT_QPA_PLATFORMTHEME: gtk3
QT_BASE_DIR: /opt/qt51512
QTDIR: $QT_BASE_DIR
PATH: $QT_BASE_DIR/bin:$PATH
LD_LIBRARY_PATH: $QT_BASE_DIR/lib:$LD_LIBRARY_PATH
PKG_CONFIG_PATH: $QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
command: bin/desktop-launch WICKRAPPNAME #alsa-launch WICKRAPPNAME
plugs:
- alsa
- audio-playback
- audio-record
- desktop
- desktop-legacy
- x11
- unity7
- wayland
- gsettings
- opengl
- home
- removable-media
- network
- network-bind
- network-manager
- network-observe
- network-control
- camera
- screen-inhibit-control
- raw-usb
parts:
qt515:
plugin: dump
source: /opt/qt51512/qt51512_5.15.12-wickr_amd64.deb
source-type: deb
stage-packages:
- libasn1-8-heimdal
- libatk-bridge2.0-0
- libatk1.0-0
- libatspi2.0-0
- libavahi-client3
- libavahi-common3
- libcairo-gobject2
- libcairo2
- libclang1-6.0
- libcups2
- libdatrie1
- libdouble-conversion3
- libdrm2
- libegl1
- libepoxy0
- libevdev2
- libevent-2.1-7
- libffi7
- libfontconfig1
- libfreetype6
- libfribidi0
- libgbm1
- libgdk-pixbuf2.0-0
- libgl1
- libglvnd0
- libglx0
- libgraphite2-3
- libgssapi3-heimdal
- libgstreamer-gl1.0-0
- libgstreamer-plugins-base1.0-0
- libgstreamer1.0-0
- libgtk-3-0
- libgudev-1.0-0
- libharfbuzz0b
- libhcrypto4-heimdal
- libheimbase1-heimdal
- libheimntlm0-heimdal
- libhogweed5
- libhunspell-1.7-0
- libhx509-5-heimdal
- libice6
- libicu66
- libinput10
- libjbig0
- libjpeg-turbo8
- libkrb5-26-heimdal
- libldap-2.4-2
- libllvm6.0
- libltdl7
- libmtdev1
- libnettle7
- libnspr4
- libnss3
- libodbc1
- libopenal1
- liborc-0.4-0
- libpango-1.0-0
- libpangocairo-1.0-0
- libpangoft2-1.0-0
- libpixman-1-0
- libpng16-16
- libpq5
- libroken18-heimdal
- libsasl2-2
- libsm6
- libsnappy1v5
- libsndio7.0
- libsybdb5
- libthai0
- libtiff5
- libtinfo6
- libwacom2
- libwayland-client0
- libwayland-cursor0
- libwayland-egl1
- libwayland-server0
- libwebp6
- libwind0-heimdal
- libx11-6
- libx11-xcb1
- libxcb-glx0
- libxcb-icccm4
- libxcb-image0
- libxcb-keysyms1
- libxcb-randr0
- libxcb-render-util0
- libxcb-render0
- libxcb-shape0
- libxcb-shm0
- libxcb-sync1
- libxcb-util1
- libxcb-xfixes0
- libxcb-xinerama0
- libxcb-xinput0
- libxcb-xkb1
- libxcomposite1
- libxcursor1
- libxdamage1
- libxext6
- libxfixes3
- libxi6
- libxinerama1
- libxkbcommon-x11-0
- libxkbcommon0
- libxml2
- libxrandr2
- libxrender1
- libxslt1.1
- libxtst6
- libpcre2-16-0
- libxau6
- libxcb1
- libxdmcp6
- libclang1-10
- libgstreamer-plugins-good1.0-0
- libmysqlclient21
- libopus0
- libpulse0
wickr:
source: ../../WickrDesktopApp/ #../../sample_app/ this is relative to the "parts" directory that's created by snapcraft
qmake-project-file: "../../../../WickrDesktopApp/desktop.pro" # "../../../../sample_app/sample_app.pro" this is relative to the "parts/wickr/src" directory
plugin: qmake
after: [desktop-qt5]#[alsa-mixin, desktop-qt5]
qmake-parameters: [WICKRQMAKECONFIGS]
build-environment:
- PATH: "/root/parts/wickr/src/conan_include/google:/opt/qt51512/bin:$PATH"
build-packages:
- libdouble-conversion3
- libicu66
- libpcre2-16-0
- libglib2.0-0
- freeglut3-dev # needed by -lGL
- libharfbuzz0b
- libsqlcipher-dev
- libssl-dev
- uuid-dev
- libbsd-dev
- libblocksruntime-dev
- libhunspell-dev
- libasound2
- libxcomposite1
- libxdamage1
- libxrandr2
- libjpeg-turbo8
- libxtst6
- libnss3
- libnspr4
- libevent-2.1-7
- libopus0
- libfontconfig1
- libsnappy1v5
- libxml2
- libxslt1.1
- libpulse0
- libqt5webengine5
stage-packages:
- libaom0
- libavcodec58
- libavformat58
- libavutil56
- libbluray2
- libchromaprint1
- libcodec2-0.9
- libgme0
- libgsm1
- libminizip1
- libopenjp2-7
- libopenmpt0
- libre2-5
- libshine3
- libsoxr0
- libssh-gcrypt-4
- libswresample3
- libva-drm2
- libva-x11-2
- libva2
- libvdpau1
- libvorbisfile3
- libwebpdemux2
- libwebpmux3
- libx264-155
- libx265-179
- libxvidcore4
- libzvbi0
override-build: |
echo $PWD
# For now CRAFT_PART_INSTALL does not work, what snapcraft changed it to for later versions
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/bin
cp /opt/qt51512/resources/icudtl.dat $SNAPCRAFT_PART_INSTALL/usr/bin
cp /opt/qt51512/resources/qtwebengine_devtools_resources.pak $SNAPCRAFT_PART_INSTALL/usr/bin
cp /opt/qt51512/resources/qtwebengine_resources_100p.pak $SNAPCRAFT_PART_INSTALL/usr/bin
cp /opt/qt51512/resources/qtwebengine_resources_200p.pak $SNAPCRAFT_PART_INSTALL/usr/bin
cp /opt/qt51512/resources/qtwebengine_resources.pak $SNAPCRAFT_PART_INSTALL/usr/bin
cp /opt/qt51512/libexec/QtWebEngineProcess $SNAPCRAFT_PART_INSTALL/usr/bin
snapcraftctl build
#ppa:
#plugin: nil
#override-pull: |
#QT_BASE_DIR=/opt/qt51512
#export QTDIR=$QT_BASE_DIR
#export PATH=$QT_BASE_DIR/bin:$PATH
##export LD_LIBRARY_PATH=$QT_BASE_DIR/lib:$LD_LIBRARY_PATH
#export PKG_CONFIG_PATH=$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
desktop-qt5:
source: https://github.com/spompelio/snapcraft-desktop-helpers.git
source-commit: 6a4a132be505da069485473bb5f486afd69f28ba
source-subdir: qt
plugin: make
after: [qt515]
make-parameters: ["FLAVOR=qt5"]
build-packages:
- build-essential
- dpkg-dev
override-stage: |
snapcraftctl stage
strip --remove-section=.note.ABI-tag opt/qt51512/lib/libQt5Core.so.5
override-prime: |
snapcraftctl prime
# needed for glib-compile-schemas to work
apt-get update && apt-get install libglib2.0-0 libglib2.0-bin apt-utils -y
cp /usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml usr/share/glib-2.0/schemas
glib-compile-schemas usr/share/glib-2.0/schemas
stage-packages:
- ttf-ubuntu-font-family
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-standard
- shared-mime-info
- libgdk-pixbuf2.0-0
- locales-all
- xdg-user-dirs
- libgtk2.0-0
- libavahi-client3
- libavahi-common3
- libboost-all-dev
- libcapnp-0.7.0 #libcapnp-0.6.1
- libcups2
- libgbm1
- libflac-dev
- libxcomposite1
- libxcursor1
- libxi6
- libxrender1
- libxss1
- libxtst6
- libasyncns0
- libfontconfig1
- libhunspell-1.7-0 #libhunspell-1.6-0
- libnspr4
- libnss3
- libogg0
- libpulse0
- libsndfile1
- libvorbis0a
- libvorbisenc2
- libxml2
- libxslt1.1
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- libslang2
- liborc-0.4-0
- libxcb-xfixes0
- libwayland-client0
- libwayland-cursor0
- libwayland-egl1
- libglu1-mesa
- libgl1-mesa-dri
- libmtdev1
- libdb5.3
- libgl1-mesa-glx
- libgpm2
- libxcb-glx0
- libxxf86vm1
- libdouble-conversion3 #libdouble-conversion1
- libxcb1
- libsm6
- libice6
- libxrandr2
- libxcb-xkb1
- libxcb-render-util0
- libxcb-randr0
- libxcb-image0
- libxcb-keysyms1
- libxcb-icccm4
- libxcb-shape0
- libxcb-util1
- libxcb-xinput0
- libxcb-xinerama0
- xkb-data
- libxkbcommon0
- libxkbcommon-x11-0
- libuuid1
- zlib1g
- libsystemd0
- liblzma5
- liblz4-1
- libgpg-error0
- libsqlcipher0
- libpsm-infinipath1
- libstdc++6
- xdg-utils
- libc-bin
- freeglut3
- libpsm2-2-compat
passthrough:
layout:
#/etc/asound.conf:
#bind-file: $SNAP/etc/asound.conf
#/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/salsa-lib:
#bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
#/usr/share/alsa/alsa.conf:
#bind-file: $SNAP/usr/share/alsa/alsa.conf
#/usr/share/alsa:
#bind: $SNAP/usr/share/alsa
plugs:
# Support for common GTK themes
# https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235
gsettings:
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
browser-sandbox:
interface: browser-support
allow-sandbox: false
This is the OLD 18.04 yaml file where the LD_LIBRARY_PATH and the other ones are exposed where the app sees it and the app snaps correctly. Look at the ppa part (OLD):
The notable section:
ppa:
plugin: nil
override-pull: |
QT_BASE_DIR=/opt/qt51514
export QTDIR=$QT_BASE_DIR
export PATH=$QT_BASE_DIR/bin:$PATH
export LD_LIBRARY_PATH=$QT_BASE_DIR/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
The old yaml:
name: WICKRLCAPPNAME
version: WICKRVERSIONNUM
summary: Secure Messaging for Teams
description: >
Wickr Secure Messaging
grade: stable
confinement: strict
base: core18
icon: snap/gui/WICKRLCAPPNAME.png
apps:
WICKRLCAPPNAME:
environment:
DISABLE_WAYLAND: 1
QT_QPA_PLATFORMTHEME: gtk3
command: desktop-launch alsa-launch WICKRAPPNAME
plugs:
- alsa
- audio-playback
- audio-record
- desktop
- desktop-legacy
- x11
- unity7
- wayland
- gsettings
- opengl
- home
- removable-media
- network
- network-bind
- network-manager
- network-observe
- network-control
- camera
- screen-inhibit-control
- raw-usb
parts:
qt515:
plugin: dump
source: /opt/qt51512/qt51512_5.15.12-wickr_amd64.deb
source-type: deb
wickr:
source: ../../../ #this is relative to the "parts" directory that's created by snapcraft
project-files: ["../../../../../desktop.pro"] #this is relative to the "parts/wickr/src" directory
plugin: qmakeppa
after: [alsa-mixin, desktop-qt5]
options: [WICKRQMAKECONFIGS]
override-prime: |
snapcraftctl prime
alsa-mixin:
plugin: nil
source: https://github.com/diddlesnaps/snapcraft-alsa.git
override-pull: |
cat > asound.conf <<EOF
pcm.!default {
type pulse
fallback "sysdefault"
hint {
show on
description "Default ALSA Output (currently PulseAudio Sound Server)"
}
}
ctl.!default {
type pulse
fallback "sysdefault"
}
EOF
cat > alsa-launch <<EOF
#!/bin/bash
export ALSA_CONFIG_PATH="\$SNAP/etc/asound.conf"
if [ -d "\$SNAP/usr/lib/alsa-lib" ]; then
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/alsa-lib"
elif [ -d "\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib" ]; then
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib"
fi
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio"
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:\$SNAP/opt/qt51512/lib"
# Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
if [ -n "\$XDG_RUNTIME_DIR" ]; then
pulsenative="pulse/native"
pulseaudio_sockpath="\$XDG_RUNTIME_DIR/../\$pulsenative"
if [ -S "\$pulseaudio_sockpath" ]; then
export PULSE_SERVER="unix:\${pulseaudio_sockpath}"
fi
fi
exec "\$@"
EOF
chmod +x alsa-launch
override-build: |
snapcraftctl build
install -m644 -D -t $SNAPCRAFT_PART_INSTALL/etc asound.conf
install -m755 -D -t $SNAPCRAFT_PART_INSTALL/snap/command-chain alsa-launch
build-packages:
- libasound2-dev
stage-packages:
- libasound2
- libasound2-plugins
ppa:
plugin: nil
override-pull: |
QT_BASE_DIR=/opt/qt51512
export QTDIR=$QT_BASE_DIR
export PATH=$QT_BASE_DIR/bin:$PATH
export LD_LIBRARY_PATH=$QT_BASE_DIR/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$QT_BASE_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
desktop-qt5:
source: https://github.com/spompelio/snapcraft-desktop-helpers.git
source-commit: 6a4a132be505da069485473bb5f486afd69f28ba
source-subdir: qt
plugin: make
after: [qt515, ppa]
make-parameters: ["FLAVOR=qt5"]
build-packages:
- build-essential
- dpkg-dev
override-stage: |
snapcraftctl stage
strip --remove-section=.note.ABI-tag opt/qt51512/lib/libQt5Core.so.5
override-prime: |
snapcraftctl prime
cp /usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml usr/share/glib-2.0/schemas
glib-compile-schemas usr/share/glib-2.0/schemas
stage-packages:
- ttf-ubuntu-font-family
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-standard
- shared-mime-info
- libgdk-pixbuf2.0-0
- locales-all
- xdg-user-dirs
- libgtk2.0-0
- libavahi-client3
- libavahi-common3
- libcapnp-0.6.1
- libcups2
- libgbm1
- libflac-dev
- libxcomposite1
- libxcursor1
- libxi6
- libxrender1
- libxss1
- libxtst6
- libasyncns0
- libfontconfig1
- libhunspell-1.6-0
- libnspr4
- libnss3
- libogg0
- libpulse0
- libsndfile1
- libvorbis0a
- libvorbisenc2
- libxml2
- libxslt1.1
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- libslang2
- liborc-0.4-0
- libxcb-xfixes0
- libwayland-client0
- libwayland-cursor0
- libwayland-egl1
- libglu1-mesa
- libgl1-mesa-dri
- libmtdev1
- libdb5.3
- libgl1-mesa-glx
- libgpm2
- libxcb-glx0
- libxxf86vm1
- libdouble-conversion1
- libxcb1
- libsm6
- libice6
- libxrandr2
- libxcb-xkb1
- libxcb-render-util0
- libxcb-randr0
- libxcb-image0
- libxcb-keysyms1
- libxcb-icccm4
- libxcb-shape0
- libxcb-util1
- libxcb-xinput0
- libxcb-xinerama0
- xkb-data
- libxkbcommon0
- libxkbcommon-x11-0
- libuuid1
- zlib1g
- libsystemd0
- liblzma5
- liblz4-1
- libgpg-error0
- libsqlcipher0
- libpsm-infinipath1
- libstdc++6
- xdg-utils
- libc-bin
passthrough:
layout:
/etc/asound.conf:
bind-file: $SNAP/etc/asound.conf
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib:
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
/usr/share/alsa/alsa.conf:
bind-file: $SNAP/usr/share/alsa/alsa.conf
plugs:
# Support for common GTK themes
# https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235
gsettings:
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
browser-sandbox:
interface: browser-support
allow-sandbox: false
When I run ‘sudo snap install wickrproalpha_6.17.1_amd64.snap --devmode --dangerous’ and then run the app with ‘wickrproalpha’ I get this error:
WickrProAlpha: error while loading shared libraries: libQt5WebEngine.so.5: cannot open shared object file: No such file or directory
Which I assume is because not setting the variables spoken about above properly.