From 3ab44e7530555523c57c4c36032c4bc24c8ba2fd Mon Sep 17 00:00:00 2001 From: xiepengfei Date: Fri, 27 Nov 2026 13:09:52 +0800 Subject: [PATCH] fix: make Qt5 (mips64el) build link DTK5 and deepin-pdfium5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. batchprint-convert reused reader sources but only got DTK include paths via imported targets (Qt6); in Qt5/DTK5 variable mode it built without any DTK includes and failed with "DApplication: No such file or directory" on shuttle. 2. libdeepin-pdfium and libdeepin-pdfium5 are built against Qt6/Qt5 respectively; their C++ ABI (QStringList/QVector mangling) is incompatible. The Qt5 build linked the Qt6 variant and failed with undefined allTextLooseRects. 3. Detect Qt before the pdfium check and pick the module per Qt version (deepin-pdfium / deepin-pdfium5), use the same variable in reader/batch-print/tests, add the libdeepin-pdfium5-dev alternative for mipsel/mips64el in debian/control, and pass DtkWidget/Gui/Core INCLUDE_DIRS/ LIBRARIES to batchprint-convert when DTK_USE_TARGETS is off. 4. Verified on a real mips64el Qt5 environment: full dpkg-buildpackage completes and produces the deb; Qt6 path unchanged (re-verified earlier on the same machine). Influence: 1. Verify the shuttle mips64el deb build completes end to end. 2. Verify amd64/arm64 (Qt6) builds are unaffected: configure picks deepin-pdfium and binaries link normally. 3. Spot check PDF word extraction / batch print on a Qt5 build. fix: Qt5(mips64el)构建补齐 DTK5 头文件并链接 deepin-pdfium5 1. batchprint-convert 复用 reader 源码,但 DTK 头文件路径此前 仅通过 Qt6 导入目标提供;Qt5/DTK5 变量模式下无任何 DTK 路径,shuttle 上报 "DApplication: No such file or directory"。 2. libdeepin-pdfium 与 libdeepin-pdfium5 分别基于 Qt6/Qt5 构建, C++ ABI(QStringList/QVector 名字修饰)互不兼容,Qt5 构建链 Qt6 变体导致 allTextLooseRects 符号找不到。 3. 将 Qt 检测提前,按 Qt 版本选择 pdfium 模块 (deepin-pdfium / deepin-pdfium5),reader/batch-print/tests 统一使用该变量;debian/control 为 mipsel/mips64el 增加 libdeepin-pdfium5-dev 备选;DTK_USE_TARGETS 关闭时向 batchprint-convert 传递 DtkWidget/Gui/Core 的 INCLUDE_DIRS 与 LIBRARIES。 4. 已在真实 mips64el Qt5 环境验证:dpkg-buildpackage 全量通过 并出包;Qt6 路径在同一台机器上此前已验证不受影响。 Influence: 1. 验证 shuttle mips64el 构建可端到端完成并出包。 2. 验证 amd64/arm64(Qt6)构建不受影响:configure 选择 deepin-pdfium 且链接正常。 3. 抽查 Qt5 构建产物的 PDF 取词与批量打印功能。 Log: No user-facing changes PMS: TASK-398545 --- CMakeLists.txt | 22 ++++++++++++++-------- batch-print/CMakeLists.txt | 17 +++++++++++++++-- debian/control | 2 +- reader/CMakeLists.txt | 4 ++-- tests/CMakeLists.txt | 12 +++++++++--- 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7bc3759..23bfd859 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,11 +18,22 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now") endif() +# 查找Qt版本(需先于 PDF 引擎模块选择:Qt5 构建走 deepin-pdfium5) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) +message(">>> Found Qt version: ${QT_VERSION_MAJOR}") +set(QT_DESIRED_VERSION ${QT_VERSION_MAJOR}) + # PDF 引擎使用系统库 deepin-pdfium(pkg-config: deepin-pdfium), -# 不再内嵌 3rdparty 源码 +# 不再内嵌 3rdparty 源码。libdeepin-pdfium 与 libdeepin-pdfium5 分别 +# 基于 Qt6/Qt5 构建,C++ ABI 不兼容,必须按 Qt 版本选择对应变体 +if(QT_VERSION_MAJOR MATCHES 6) + set(DEEPIN_PDFIUM_MODULE deepin-pdfium) +else() + set(DEEPIN_PDFIUM_MODULE deepin-pdfium5) +endif() find_package(PkgConfig REQUIRED) -pkg_check_modules(DEEPIN_PDFIUM REQUIRED deepin-pdfium) -message(STATUS "Using system deepin-pdfium: ${DEEPIN_PDFIUM_VERSION}") +pkg_check_modules(DEEPIN_PDFIUM REQUIRED ${DEEPIN_PDFIUM_MODULE}) +message(STATUS "Using system deepin-pdfium: ${DEEPIN_PDFIUM_VERSION} (module: ${DEEPIN_PDFIUM_MODULE})") # 设置C++标准 set(CMAKE_CXX_STANDARD 17) @@ -173,11 +184,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) # 引入翻译生成 include(translation-generate) -# 查找Qt版本 -find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) -message(">>> Found Qt version: ${QT_VERSION_MAJOR}") -set(QT_DESIRED_VERSION ${QT_VERSION_MAJOR}) - # 设置DTK版本 if (QT_VERSION_MAJOR MATCHES 6) set(DTK_VERSION_MAJOR 6) diff --git a/batch-print/CMakeLists.txt b/batch-print/CMakeLists.txt index 3bf870e5..600c4141 100644 --- a/batch-print/CMakeLists.txt +++ b/batch-print/CMakeLists.txt @@ -9,8 +9,8 @@ pkg_check_modules(FREETYPE REQUIRED freetype2) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS DBus PrintSupport Sql) -# PDF 引擎:系统库 deepin-pdfium(reader/ 创建的目标只作用于其子树) -pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET deepin-pdfium) +# PDF 引擎:系统库 deepin-pdfium(模块名由顶层按 Qt 版本选择,Qt5 走 deepin-pdfium5) +pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET ${DEEPIN_PDFIUM_MODULE}) # batchprint-core: CupsClient + NotifyClient + PrintSettings + ErrorMessages (no reader source dependency) add_library(batchprint-core STATIC @@ -104,6 +104,19 @@ if(DTK_USE_TARGETS) Dtk${DTK_VERSION_MAJOR}::Gui Dtk${DTK_VERSION_MAJOR}::Core ) +else() + # Qt5/DTK5 变量模式:老式 find_package 无导入目标,需手动补 DTK + # 头文件路径与链接库(与 reader 主目标的做法一致) + target_include_directories(batchprint-convert PUBLIC + ${DtkWidget_INCLUDE_DIRS} + ${DtkGui_INCLUDE_DIRS} + ${DtkCore_INCLUDE_DIRS} + ) + target_link_libraries(batchprint-convert PUBLIC + ${DtkWidget_LIBRARIES} + ${DtkGui_LIBRARIES} + ${DtkCore_LIBRARIES} + ) endif() if (QT_VERSION_MAJOR MATCHES 6) diff --git a/debian/control b/debian/control index f6e8e7fd..17b21a16 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: cmake, debhelper (>= 11), pkg-config, - libdeepin-pdfium-dev (>= 1.5.8), + libdeepin-pdfium5-dev (>= 1.5.7) [mipsel mips64el] | libdeepin-pdfium-dev (>= 1.5.8), qt6-5compat-dev [!mipsel !mips64el] | libqt5x11extras5-dev, qt6-base-dev [!mipsel !mips64el] | qtbase5-dev, qt6-tools-dev-tools [!mipsel !mips64el] | qttools5-dev-tools, diff --git a/reader/CMakeLists.txt b/reader/CMakeLists.txt index cbf83015..fafb6151 100644 --- a/reader/CMakeLists.txt +++ b/reader/CMakeLists.txt @@ -3,8 +3,8 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(LIBJPEG REQUIRED libjpeg) pkg_check_modules(DDJVU REQUIRED ddjvuapi) -# PDF 引擎:系统库 deepin-pdfium -pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET deepin-pdfium) +# PDF 引擎:系统库 deepin-pdfium(模块名由顶层按 Qt 版本选择,Qt5 走 deepin-pdfium5) +pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET ${DEEPIN_PDFIUM_MODULE}) if (XPS_SUPPORT_ENABLED) pkg_check_modules(XPS_DEPS REQUIRED libgxps cairo glib-2.0 gobject-2.0 freetype2) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 474c7192..9c4ad596 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -12,13 +12,19 @@ pkg_check_modules(LIBJPEG REQUIRED libjpeg) pkg_check_modules(DDJVU REQUIRED ddjvuapi) pkg_check_modules(FREETYPE REQUIRED freetype2) -# PDF 引擎:系统库 deepin-pdfium -pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET deepin-pdfium) - # 查找 Qt 版本(优先 Qt6) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) set(QT_DESIRED_VERSION ${QT_VERSION_MAJOR}) +# PDF 引擎:系统库 deepin-pdfium(libdeepin-pdfium/libdeepin-pdfium5 分别 +# 基于 Qt6/Qt5 构建,C++ ABI 不兼容,按 Qt 版本选择变体) +if(QT_VERSION_MAJOR MATCHES 6) + set(DEEPIN_PDFIUM_MODULE deepin-pdfium) +else() + set(DEEPIN_PDFIUM_MODULE deepin-pdfium5) +endif() +pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET ${DEEPIN_PDFIUM_MODULE}) + message(STATUS ">>> Test building with Qt${QT_DESIRED_VERSION}") # 定义必需的 Qt 组件