From 113d4ab5edbe8d751eefd7a94bd4a7a6505511e5 Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Fri, 20 Nov 2026 13:26:28 +0100 Subject: [PATCH] Mount-independent GeographicLib rpath and DEB production fixes - CMakeLists.txt: add a $ORIGIN-based CMAKE_BUILD_RPATH entry for the bundled GeographicLib (include/GeographicLib/lib), like the existing RTI entry. The imported GeographicLib target only contributed the absolute container mount path to the build RUNPATH, so binaries could not resolve libGeographicLib.so.26 outside the /repo mount. Verified: ddsview built and run in a container with a different mount prefix resolves it via $ORIGIN and starts (rc=0). - new_docker_build.sh: seed the DEB cmake with ARCGIS_INCLUDE_DIR / ARCGIS_LIBRARY (the staged source copy cannot resolve the ArcGIS SDK, which is a relative symlink to the pipeline root dangling after staging); retry the build-tree removal with a clear error when a concurrent build/IDE keeps the directory busy. - Dockerfile: add a late apt layer with devscripts + debhelper (debuild, dh) for the DEB flow; cached Qt/KDReports layers are preserved. - README.md: document that --run-coverage and --run-jenkins-builder are combinable (DEB step runs after the coverage collection). --- qt6-after/qt6-migrated-legatus/CMakeLists.txt | 8 +++++ qt6-after/qt6-migrated-legatus/Dockerfile | 6 ++++ qt6-after/qt6-migrated-legatus/README.md | 8 +++-- .../qt6-migrated-legatus/new_docker_build.sh | 36 ++++++++++++++----- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/qt6-after/qt6-migrated-legatus/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/CMakeLists.txt index d21d31aba..34fc4d0ae 100755 --- a/qt6-after/qt6-migrated-legatus/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/CMakeLists.txt @@ -51,6 +51,14 @@ SET(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/lib") SET(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH};" "$ORIGIN/../../../../external/rti_connext_dds-7.7.0/resource/app/lib/x64Linux4gcc8.5.0") +# GeographicLib is bundled in the tree (include/GeographicLib/lib). Add the +# $ORIGIN form so binaries resolve it relative to the build tree instead of +# the absolute container mount path (the imported target only provides the +# absolute dir). bin/ and lib/ sit at the same depth, so one entry serves +# both. +SET(CMAKE_BUILD_RPATH + "${CMAKE_BUILD_RPATH};" + "$ORIGIN/../../qt6-migrated-legatus/include/GeographicLib/lib") SET(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib") SET(CMAKE_BUILD_RPATH_USE_ORIGIN ON) diff --git a/qt6-after/qt6-migrated-legatus/Dockerfile b/qt6-after/qt6-migrated-legatus/Dockerfile index 46e44f0f0..00d297f71 100644 --- a/qt6-after/qt6-migrated-legatus/Dockerfile +++ b/qt6-after/qt6-migrated-legatus/Dockerfile @@ -65,6 +65,12 @@ RUN git clone --depth 1 https://github.com/KDAB/KDReports.git /tmp/KDReports && # Legacy sources include RUN ln -sfn KDReports-qt6 /usr/local/include/KDReports +# Debian packaging tools for the DEB flow (debuild, dh). Separate late layer +# so the Qt/KDReports layers above stay cached when this list changes. +RUN apt-get update -qq && \ + apt-get install -y -qq --no-install-recommends devscripts debhelper && \ + rm -rf /var/lib/apt/lists/* + ENV PATH="${QT_BASE_DIR}/${QT_VERSION}/gcc_64/bin:${PATH}" ENV CMAKE_PREFIX_PATH="${QT_BASE_DIR}/${QT_VERSION}/gcc_64" diff --git a/qt6-after/qt6-migrated-legatus/README.md b/qt6-after/qt6-migrated-legatus/README.md index b0138b082..4f74abad5 100644 --- a/qt6-after/qt6-migrated-legatus/README.md +++ b/qt6-after/qt6-migrated-legatus/README.md @@ -281,8 +281,10 @@ them as-is, or `chown` the directory on the host to edit/move it. `--coverage-output-dir DIR` moves the report; `DIR` must be an absolute path under the pipeline root (relative values are ignored and the -default above is used). The option is mutually exclusive with -`--run-jenkins-builder`. +default above is used). Combined with `--run-jenkins-builder`, the +instrumented build + ctest + lcov collection run first and the DEB +production runs afterwards — the DEB builds in its own staged directory +and never touches the build tree, so the report is left intact. ## Manual commands (without the driver) @@ -399,7 +401,7 @@ The main ones: | `--run-jenkins-builder` | off | produce the DEB packages (Step 4) | | `--package-output-dir DIR` | `./packages-out` | pass-through (see Step 4 note) | | `--lts-version / --project / --build-number / --build-tag` | `1.0` / `guez` / `1` / `manual-build` | package metadata | -| `--run-coverage` | off | instrument with `-O0 --coverage`, run ctest, collect the lcov report (Step 6); mutually exclusive with `--run-jenkins-builder` | +| `--run-coverage` | off | instrument with `-O0 --coverage`, run ctest, collect the lcov report (Step 6); combinable with `--run-jenkins-builder` (DEB step then runs afterwards) | | `--coverage-output-dir DIR` | `qt6-after/build/coverage//` | report dir (inside the build tree) — only absolute paths under the pipeline root are honored (Step 6) | Environment overrides: `BUILD_GROUP1/3/5/6`, `RUN_CTEST`, `TESTS_ONLY`, diff --git a/qt6-after/qt6-migrated-legatus/new_docker_build.sh b/qt6-after/qt6-migrated-legatus/new_docker_build.sh index 8bdd95e88..ffe754017 100755 --- a/qt6-after/qt6-migrated-legatus/new_docker_build.sh +++ b/qt6-after/qt6-migrated-legatus/new_docker_build.sh @@ -49,8 +49,10 @@ Packages (DEB, via in-tree rpmbuild/make_rpm_ubuntu26_release2.py): Coverage (lcov): --run-coverage Build with -O0 --coverage, run ctest and collect - the lcov report (README.md Step 6) - --coverage-output-dir DIR Report dir (default: /coverage/ + the lcov report (README.md Step 6). Can be + combined with --run-jenkins-builder: the DEB + step then runs after the coverage collection. + --coverage-output-dir DIR Report dir (default: qt6-after/build/coverage/ //; honored when it is an absolute path under the pipeline root) @@ -155,10 +157,9 @@ while [[ $# -gt 0 ]]; do esac done -# Validate mutually exclusive options -if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]] && [[ "${RUN_COVERAGE}" == "ON" ]]; then - die "Error: --run-jenkins-builder and --run-coverage are mutually exclusive" -fi +# --run-jenkins-builder and --run-coverage can be combined: the instrumented +# build + ctest + lcov collection run first, then the DEB production (which +# builds in its own staged directory and never touches the build tree). require_command() { if ! command -v "$1" &> /dev/null; then @@ -262,7 +263,16 @@ fi log_info "Configuring CMake..." BUILD_DIR="../build" log_info "Using build directory: ${BUILD_DIR}" -rm -rf "${BUILD_DIR}" +# Remove the old build tree. A concurrent build (e.g. an IDE) can keep the +# directory non-empty while it is being deleted; retry before giving up. +rm_ok=0 +for _ in 1 2 3; do + if rm -rf "${BUILD_DIR}" 2>/dev/null; then rm_ok=1; break; fi + sleep 2 +done +if [[ "${rm_ok}" != "1" ]]; then + die "Cannot remove ${BUILD_DIR} — is another build or IDE using it?" +fi mkdir -p "${BUILD_DIR}" # Make it absolute: later steps (ctest/coverage) cd elsewhere and must # still find the build tree. @@ -443,6 +453,16 @@ if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then die "Staged source incomplete under ${STAGE_DIR} (CMakeLists.txt or make_rpm_ubuntu26_release2.py missing)" fi + # ArcGIS: the staged source copy cannot resolve the SDK (external/ArcGIS + # in the tree is a relative symlink to the pipeline root, dangling after + # staging). FindArcGIS trusts ARCGIS_INCLUDE_DIR + ARCGIS_LIBRARY when + # both are preset, so seed them with the SDK under the mount root. + ARCGIS_SDK_PATH="${DOCKER_MOUNT_ROOT}/external/ArcGIS/MapsSDK_Qt_300.0.0/ArcGIS_Maps_SDK_Qt_300.0.0/qt300.0.0/sdk" + ARCGIS_CMAKE_FLAGS="" + if [[ -d "${ARCGIS_SDK_PATH}" && -f "${ARCGIS_SDK_PATH}/linux/x64/lib/libEsriRuntimeQt.a" ]]; then + ARCGIS_CMAKE_FLAGS=" -DARCGIS_INCLUDE_DIR=${ARCGIS_SDK_PATH}/include -DARCGIS_LIBRARY=${ARCGIS_SDK_PATH}/linux/x64/lib/libEsriRuntimeQt.a" + fi + log_info "Running rpmbuild/make_rpm_ubuntu26_release2.py (PROJECT=${PROJECT} OS_VERSION=${OS_VERSION} LTS_VERSION=${LTS_VERSION} GUEZ_MODE=${GUEZ_MODE} BUILD_NUMBER=${BUILD_NUMBER} BUILD_TAG=${BUILD_TAG})" cd "${STAGE_DIR}/rpmbuild" if python3 make_rpm_ubuntu26_release2.py -c LTS \ @@ -450,7 +470,7 @@ if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then --version "${LTS_VERSION}" \ --output_dir "${DOCKER_MOUNT_ROOT}/rpms/${PROJECT}/${OS_VERSION}/" \ --source_dir "${STAGE_DIR}" \ - --cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DBUILD_RTI=ON -DRELEASE_BUILD=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ " \ + --cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DBUILD_RTI=ON -DRELEASE_BUILD=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ ${ARCGIS_CMAKE_FLAGS}" \ --build_targets "${GROUP1_TARGETS[*]} ${GROUP3_TARGETS[*]} ${GROUP5_TARGETS[*]} ${GROUP6_TARGETS[*]}" \ --build_number "${BUILD_NUMBER}" \ --release_scope; then