From 09c7ab665c10b88ee04f9c93e0fd014780eeabb8 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Thu, 16 Apr 2026 12:43:09 +0800 Subject: [PATCH] fix some appimage issues (#13210) --- deps/OpenCV/OpenCV.cmake | 2 ++ deps/wxWidgets/wxWidgets.cmake | 1 + scripts/appimage_lib_policy.sh | 29 +++++++++++++++++-- .../platform/unix/build_appimage.sh.in | 7 ++++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/deps/OpenCV/OpenCV.cmake b/deps/OpenCV/OpenCV.cmake index ad8c0a3585..4b3fcf0151 100644 --- a/deps/OpenCV/OpenCV.cmake +++ b/deps/OpenCV/OpenCV.cmake @@ -55,6 +55,8 @@ orcaslicer_add_cmake_project(OpenCV -DWITH_VTK=OFF -DWITH_JPEG=OFF -DWITH_WEBP=OFF + -DWITH_TIFF=OFF + -DBUILD_TIFF=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DINSTALL_TESTS=OFF -DINSTALL_C_EXAMPLES=OFF diff --git a/deps/wxWidgets/wxWidgets.cmake b/deps/wxWidgets/wxWidgets.cmake index 81560a96e2..682b28bac4 100644 --- a/deps/wxWidgets/wxWidgets.cmake +++ b/deps/wxWidgets/wxWidgets.cmake @@ -52,6 +52,7 @@ orcaslicer_add_cmake_project( -DwxUSE_ZLIB=sys -DwxUSE_LIBJPEG=sys -DwxUSE_LIBTIFF=OFF + -DwxUSE_LIBWEBP=builtin -DwxUSE_EXPAT=sys -DwxUSE_NANOSVG=OFF ) diff --git a/scripts/appimage_lib_policy.sh b/scripts/appimage_lib_policy.sh index 95defebd68..35925227a0 100755 --- a/scripts/appimage_lib_policy.sh +++ b/scripts/appimage_lib_policy.sh @@ -28,11 +28,36 @@ appimage_is_elf_file() { appimage_list_direct_dependencies() { local target="$1" - local line dep + local line dep dep_name + declare -A needed=() + + # Use objdump to identify the direct DT_NEEDED entries first. ldd reports the + # full runtime tree, which can accidentally pull transitive dependencies of the + # host GTK/pixbuf stack into the AppImage bundle. + while IFS= read -r dep_name; do + if [[ -n "$dep_name" ]]; then + needed["$dep_name"]=1 + fi + done < <(objdump -p "$target" 2>/dev/null | awk '$1 == "NEEDED" { print $2 }') + + if (( ${#needed[@]} == 0 )); then + return 0 + fi while IFS= read -r line; do + dep_name="" + if [[ "$line" == *"=>"* ]]; then + dep_name="$(printf '%s\n' "$line" | awk '{print $1}')" + elif [[ "$line" =~ ^[[:space:]]/ ]]; then + dep_name="$(basename "$(printf '%s\n' "$line" | awk '{print $1}')")" + fi + + if [[ -z "$dep_name" || -z "${needed[$dep_name]+x}" ]]; then + continue + fi + if [[ "$line" == *"=> not found"* ]]; then - echo "MISSING:${line%% *}" + echo "MISSING:$dep_name" continue fi diff --git a/src/dev-utils/platform/unix/build_appimage.sh.in b/src/dev-utils/platform/unix/build_appimage.sh.in index 372f16d301..f41025c45a 100644 --- a/src/dev-utils/platform/unix/build_appimage.sh.in +++ b/src/dev-utils/platform/unix/build_appimage.sh.in @@ -1,5 +1,7 @@ #!/usr/bin/env bash APPIMAGETOOLURL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../../.." && pwd)" APP_IMAGE="@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" @@ -33,7 +35,10 @@ mkdir -p usr/share/applications cp com.orcaslicer.@SLIC3R_APP_KEY@.desktop usr/share/applications/ mkdir -p usr/share/metainfo -cp @CMAKE_CURRENT_SOURCE_DIR@/scripts/flatpak/com.orcaslicer.@SLIC3R_APP_KEY@.metainfo.xml usr/share/metainfo/ +cp "${REPO_ROOT}/scripts/flatpak/com.orcaslicer.@SLIC3R_APP_KEY@.metainfo.xml" \ + "usr/share/metainfo/com.orcaslicer.@SLIC3R_APP_KEY@.metainfo.xml" +cp "${REPO_ROOT}/scripts/flatpak/com.orcaslicer.@SLIC3R_APP_KEY@.metainfo.xml" \ + "usr/share/metainfo/com.orcaslicer.@SLIC3R_APP_KEY@.appdata.xml" export ARCH=$(uname -m)