Skip to content

Commit b17135d

Browse files
committed
AppImage: better handle libOpenGL.so.0
the previous actually didn't work properly, because uv-qt depend on libQt6OpenGL.so.6 which in turn depend on libOpenGL.so.0. But LD_LIBRARY_PATH is not set inside the AI so the transitive dep is not handled and thus the preload is not applied. Querying libQt6OpenGL.so.6 directly also don't work because it resolves to the libOpenGL.so.0 in the same library, from which we cannot deduce if its counterpart is inside the system.
1 parent 656b0a7 commit b17135d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

data/scripts/Linux-AppImage/AppRun

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,20 @@ setup_wayland() {
263263
n_ld_library_path="$n_ld_library_path:$AI_LIB_PATH/wayland"
264264
}
265265

266+
setup_libopengl() {
267+
qt_ogl=$(echo "$DIR"/usr/lib/libQt[5-9]OpenGL.so*)
268+
LOADER=$(get_loader)
269+
if [ ! -x "$LOADER" ] || [ ! -f "$qt_ogl" ]; then
270+
return
271+
fi
272+
ldd=$(LD_TRACE_LOADED_OBJECTS=1 "$LOADER" "$qt_ogl")
273+
if ! echo "$ldd" | grep libOpenGL.so.0 | grep -q 'not found'; then
274+
return # we have libOpenGL.so.0 in system
275+
fi
276+
debug_msg "Using bundled libOpenGL.so.0*"
277+
n_ld_library_path="$n_ld_library_path:$AI_LIB_PATH/libopengl"
278+
}
279+
266280
add_whitelist() {
267281
# expand tilde expansion (like ~/video.mp4; only single ~ now)
268282
# shellcheck disable=SC2088 # intentional
@@ -370,11 +384,11 @@ get_custom_firejail_rules() {
370384
. "$DIR/scripts/preload.sh"
371385
setup_vaapi
372386
setup_wayland
387+
setup_libopengl
373388
# ultragrid_aplay_jack.so is not used because it loads JACK with dlopen,
374389
# while portaudio is linked directly to JACK library
375390
set_ld_preload ultragrid_aplay_portaudio.so libjack
376391
set_ld_preload ultragrid_vidcap_pipewire.so libpipewire
377-
set_ld_preload_exe "$AI_LIB_PATH/../bin/uv-qt" libOpenGL.so.0
378392

379393
## @param $@ <tool> <arguments
380394
setup_firejail() {

data/scripts/Linux-AppImage/create-appimage.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ if ls $APPPREFIX/lib/libwayland-* >/dev/null 2>&1; then
111111
mv $APPPREFIX/lib/libwayland-* $APPPREFIX/lib/wayland
112112
fi
113113

114+
# hide libOpenGL.so.0 libraries
115+
if [ -f $APPPREFIX/lib/libOpenGL.so.0 ]; then
116+
mkdir $APPPREFIX/lib/libopengl
117+
mv $APPPREFIX/lib/libOpenGL.so.0 $APPPREFIX/lib/libopengl
118+
fi
119+
114120
add_fonts
115121

116122
if command -v curl >/dev/null; then

0 commit comments

Comments
 (0)