Skip to content

Commit

Permalink
Linux: Fix AppRun for GStreamer
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Oct 18, 2024
1 parent 13031c3 commit fa6bbad
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
large-packages: false
continue-on-error: true

- name: Checkout repo
Expand Down
27 changes: 16 additions & 11 deletions cmake/CreateAppImage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@ message(STATUS "Creating AppImage")
# TODO: https://github.com/AppImageCommunity/AppImageUpdate

set(APPDIR_PATH "${CMAKE_BINARY_DIR}/AppDir")
# set(APPIMAGETOOL_PATH "${CMAKE_BINARY_DIR}/appimagetool-x86_64.AppImage")
set(APPIMAGETOOL_PATH "${CMAKE_BINARY_DIR}/appimagetool-x86_64.AppImage")
set(LD_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-x86_64.AppImage")
set(LD_APPIMAGEPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-appimage-x86_64.AppImage")
# set(LD_APPIMAGEPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-appimage-x86_64.AppImage")
# set(LD_QTPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-qt-x86_64.AppImage")
# set(LD_GSTPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-gstreamer.sh")
# set(LD_GTKPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-gtk.sh")

# if(NOT EXISTS "${APPIMAGETOOL_PATH}")
# file(DOWNLOAD https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage "${APPIMAGETOOL_PATH}")
# execute_process(COMMAND chmod a+x "${APPIMAGETOOL_PATH}")
# endif()
if(NOT EXISTS "${APPIMAGETOOL_PATH}")
file(DOWNLOAD https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage "${APPIMAGETOOL_PATH}")
# file(DOWNLOAD https://github.com/probonopd/go-appimage/releases/download/832/appimagetool-823-x86_64.AppImage "${APPIMAGETOOL_PATH}") # TODO: Use Continuous Release
execute_process(COMMAND chmod a+x "${APPIMAGETOOL_PATH}")
endif()
if(NOT EXISTS "${LD_PATH}")
file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage "${LD_PATH}")
execute_process(COMMAND chmod a+x "${LD_PATH}")
endif()
if(NOT EXISTS "${LD_APPIMAGEPLUGIN_PATH}")
file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage "${LD_APPIMAGEPLUGIN_PATH}")
execute_process(COMMAND chmod a+x "${LD_APPIMAGEPLUGIN_PATH}")
endif()
# if(NOT EXISTS "${LD_APPIMAGEPLUGIN_PATH}")
# file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage "${LD_APPIMAGEPLUGIN_PATH}")
# execute_process(COMMAND chmod a+x "${LD_APPIMAGEPLUGIN_PATH}")
# endif()
# if(NOT EXISTS "${LD_QTPLUGIN_PATH}")
# file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage "${LD_QTPLUGIN_PATH}")
# execute_process(COMMAND chmod a+x "${LD_QTPLUGIN_PATH}")
Expand All @@ -34,7 +35,7 @@ endif()
# execute_process(COMMAND chmod a+x "${LD_GSTPLUGIN_PATH}")
# endif()

execute_process(COMMAND ${LD_PATH} --appdir ${APPDIR_PATH} --output appimage --custom-apprun ${CMAKE_BINARY_DIR}/AppRun)
execute_process(COMMAND ${LD_PATH} --appdir ${APPDIR_PATH} --custom-apprun ${CMAKE_BINARY_DIR}/AppRun)
# --exclude-library "libX*"
# --exclude-library "libglib*"
# --exclude-library "libgobject*"
Expand All @@ -48,3 +49,7 @@ execute_process(COMMAND ${LD_PATH} --appdir ${APPDIR_PATH} --output appimage --c
# --exclude-library "libgst*"
# --exclude-library "libgthread*"
# --plugin qt --plugin gtk --plugin gstreamer

set(ENV{ARCH} x86_64)
# set(ENV{VERSION} 5.0)
execute_process(COMMAND ${APPIMAGETOOL_PATH} ${APPDIR_PATH})
10 changes: 5 additions & 5 deletions cmake/find-modules/FindGStreamer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ endif()
if(App IN_LIST GStreamer_FIND_COMPONENTS)
find_gstreamer_component(App
PC_NAME gstreamer-app-1.0
HEADER gst/app/gstappsink.h
HEADER gst/app/app.h
LIBRARY gstapp-1.0
DEPENDENCIES GStreamer::Core GStreamer::Base)
endif()
Expand Down Expand Up @@ -319,7 +319,7 @@ endif()
if(Fft IN_LIST GStreamer_FIND_COMPONENTS)
find_gstreamer_component(Fft
PC_NAME gstreamer-fft-1.0
HEADER gst/fft/cfft.h
HEADER gst/fft/fft.h
LIBRARY gstfft-1.0
DEPENDENCIES GStreamer::Core)
endif()
Expand All @@ -328,7 +328,7 @@ if(GlEgl IN_LIST GStreamer_FIND_COMPONENTS)
# find_package(EGL)
find_gstreamer_component(GlEgl
PC_NAME gstreamer-gl-egl-1.0
HEADER gst/gl/egl/gstgldisplay_egl.h
HEADER gst/gl/egl/egl.h
LIBRARY gstgl-1.0
DEPENDENCIES GStreamer::Gl EGL::EGL)
endif()
Expand All @@ -350,7 +350,7 @@ if(GlWayland IN_LIST GStreamer_FIND_COMPONENTS)
# find_package(Qt6 COMPONENTS WaylandClient)
find_gstreamer_component(GlWayland
PC_NAME gstreamer-gl-wayland-1.0
HEADER gst/gl/wayland/gstgldisplay_wayland.h
HEADER gst/gl/wayland/wayland.h
LIBRARY gstgl-1.0
DEPENDENCIES GStreamer::Gl Wayland::EGL Wayland::Client)
endif()
Expand All @@ -361,7 +361,7 @@ if(GlX11 IN_LIST GStreamer_FIND_COMPONENTS)
# find_package(X11_XCB)
find_gstreamer_component(GlX11
PC_NAME gstreamer-gl-x11-1.0
HEADER gst/gl/x11/gstgldisplay_x11.h
HEADER gst/gl/x11/x11.h
LIBRARY gstgl-1.0
DEPENDENCIES GStreamer::Gl X11::XCB)
endif()
Expand Down
30 changes: 16 additions & 14 deletions deploy/linux/AppRun
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
#!/bin/bash

set -e
if [ -z "$APPDIR" ]; then
APPDIR="$(dirname "$(readlink -f "$0")")"
fi

HERE="$(dirname "$(readlink -f "${0}")")"

# export LD_LIBRARY_PATH="$HERE/usr/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${APPDIR}/usr/lib/gstreamer-1.0:${LD_LIBRARY_PATH}"

export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no"
export GIO_EXTRA_MODULES="$HERE/usr/lib/gio/modules"
export GIO_EXTRA_MODULES="${APPDIR}/usr/lib/gio/modules"

export GST_PLUGIN_SYSTEM_PATH="${APPDIR}/usr/lib/gstreamer-1.0"
export GST_PLUGIN_SYSTEM_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0"
export GST_PLUGIN_PATH="${APPDIR}/usr/lib/gstreamer-1.0"
export GST_PLUGIN_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0"
export GST_PLUGIN_SCANNER="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
export GST_PLUGIN_SCANNER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
export GST_PTP_HELPER="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"
export GST_PTP_HELPER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"

export GST_PLUGIN_SYSTEM_PATH="$HERE/usr/lib/gstreamer-1.0"
export GST_PLUGIN_SYSTEM_PATH_1_0="$HERE/usr/lib/gstreamer-1.0"
export GST_PLUGIN_PATH="$HERE/usr/lib/gstreamer-1.0"
export GST_PLUGIN_PATH_1_0="$HERE/usr/lib/gstreamer-1.0"
export GST_PLUGIN_SCANNER="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
export GST_PLUGIN_SCANNER_1_0="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
export GST_PTP_HELPER="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"
export GST_PTP_HELPER_1_0="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"
export QT_QPA_PLATFORM="xcb"

exec "$HERE/usr/bin/QGroundControl" "$@"
exec "${APPDIR}/usr/bin/QGroundControl" "$@"
13 changes: 7 additions & 6 deletions src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ GST_PLUGIN_STATIC_DECLARE(mpegtsdemux);
GST_PLUGIN_STATIC_DECLARE(opengl);
GST_PLUGIN_STATIC_DECLARE(tcp);
GST_PLUGIN_STATIC_DECLARE(asf);
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_MAC)
GST_PLUGIN_STATIC_DECLARE(va);
#endif
// #ifndef Q_OS_ANDROID
// GST_PLUGIN_STATIC_DECLARE(va);
// #endif
#ifdef Q_OS_ANDROID
GST_PLUGIN_STATIC_DECLARE(androidmedia);
#elif defined(Q_OS_IOS)
Expand Down Expand Up @@ -115,6 +115,7 @@ static void _setGstEnvVars()
_qgcputenv("GST_PLUGIN_SYSTEM_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0");
_qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0");
_qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0");
_qgcputenv("GTK_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0");
#elif defined(Q_OS_WIN)
_qgcputenv("GST_REGISTRY_REUSE_PLUGIN_SCANNER", "no");
_qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/../libexec/gstreamer-1.0/gst-plugin-scanner");
Expand Down Expand Up @@ -145,9 +146,9 @@ static void _registerPlugins()
GST_PLUGIN_STATIC_REGISTER(opengl);
GST_PLUGIN_STATIC_REGISTER(tcp);
GST_PLUGIN_STATIC_REGISTER(asf);
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_MAC)
GST_PLUGIN_STATIC_REGISTER(va);
#endif
// #ifndef Q_OS_ANDROID
// GST_PLUGIN_STATIC_REGISTER(va);
// #endif
#ifdef Q_OS_ANDROID
GST_PLUGIN_STATIC_REGISTER(androidmedia);
#elif defined(Q_OS_IOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ endif()

if(LINUX)
install(DIRECTORY ${GSTREAMER_LIB_PATH}/gstreamer1.0 DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(CODE "execute_process(COMMAND chmod +x \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner\")")
install(CODE "execute_process(COMMAND chmod +x \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/gstreamer1.0/gstreamer-1.0/gst-ptp-helper\")")
install(DIRECTORY ${GSTREAMER_LIB_PATH}/gio DESTINATION ${CMAKE_INSTALL_LIBDIR})
get_target_property(LINKED_PLUGINS GStreamer::Plugins INTERFACE_LINK_LIBRARIES)
install(FILES ${LINKED_PLUGINS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/gstreamer-1.0)
Expand Down Expand Up @@ -213,6 +215,8 @@ endif()

################################################################################

# DYLD_LIBRARY_PATH

# <key>LSEnvironment</key>
# <dict>
# <key>GST_REGISTRY_REUSE_PLUGIN_SCANNER</key>
Expand Down
18 changes: 12 additions & 6 deletions tools/setup/install-dependencies-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-present0 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-render0 \
Expand Down Expand Up @@ -94,13 +95,23 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \
libz-dev \
zlib1g-dev

# Additional
# Speech
DEBIAN_FRONTEND=noninteractive apt -y --quiet install \
flite1-dev \
libspeechd-dev \
speech-dispatcher \
speech-dispatcher-espeak \
speech-dispatcher-espeak-ng \
speech-dispatcher-flite \

# Additional
DEBIAN_FRONTEND=noninteractive apt -y --quiet install \
gvfs \
intel-media-va-driver \
libasound2-dev \
libass-dev \
libdrm-dev \
libelf-dev \
libegl1-mesa-dev \
libgbm-dev \
libgl1-mesa-dev \
Expand All @@ -113,7 +124,6 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \
libopenal-dev \
libpulse-dev \
libsdl2-dev \
libspeechd-dev \
libshp-dev \
libunwind-dev \
libva-dev \
Expand All @@ -127,10 +137,6 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \
mesa-va-drivers \
mesa-vdpau-drivers \
mesa-vulkan-drivers \
speech-dispatcher \
speech-dispatcher-espeak \
speech-dispatcher-espeak-ng \
speech-dispatcher-flite \
vainfo

if apt-cache show libvpl-dev >/dev/null 2>&1 && apt-cache show libvpl-dev 2>/dev/null | grep -q "^Package: libvpl-dev"; then
Expand Down

0 comments on commit fa6bbad

Please sign in to comment.