From 886ed6e978ba38f959279f793def525f9dd1cebd Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Tue, 21 Jul 2026 22:18:04 +0200 Subject: [PATCH] Pin ament install destinations to lib/include/bin (fixes #1175) The ROS build farm (bloom/debhelper) configures with -DCMAKE_INSTALL_LIBDIR=lib/. Since #1152 made the BTCPP_*_DESTINATION variables honor GNUInstallDirs, farm binaries installed libbehaviortree_cpp.so to /opt/ros//lib/x86_64-linux-gnu, which breaks ament_export_libraries lookup in downstream packages and is not on the LD_LIBRARY_PATH set by the ament environment hooks. Shadow the cache variables with plain set() in the ament build path, so ROS builds always install to $prefix/lib regardless of CMAKE_INSTALL_LIBDIR, while standalone builds keep the GNUInstallDirs override behavior introduced for #1120. Also add a ros2-lyrical CI job that emulates the build farm flags and asserts the library lands in $prefix/lib. Co-Authored-By: Claude Fable 5 --- .github/workflows/ros2-lyrical.yaml | 36 +++++++++++++++++++++++++++++ cmake/ament_build.cmake | 10 ++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/ros2-lyrical.yaml diff --git a/.github/workflows/ros2-lyrical.yaml b/.github/workflows/ros2-lyrical.yaml new file mode 100644 index 000000000..9f997af2b --- /dev/null +++ b/.github/workflows/ros2-lyrical.yaml @@ -0,0 +1,36 @@ +name: ros2-lyrical + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + industrial_ci: + strategy: + matrix: + env: + # TARGET_CMAKE_ARGS emulates the ROS build farm (bloom/debhelper), + # which configures with -DCMAKE_INSTALL_LIBDIR=lib/. + # AFTER_SCRIPT asserts that the library is still installed to + # $prefix/lib, as required by ament tooling (see issue #1175). + - ROS_DISTRO: lyrical + ROS_REPO: main + TARGET_CMAKE_ARGS: -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu + AFTER_SCRIPT: >- + lib=$(find "$BASEDIR/target_ws/install" -name libbehaviortree_cpp.so); + echo "libbehaviortree_cpp.so installed at: ${lib:-NOT FOUND}"; + [[ "$lib" == */install/behaviortree_cpp/lib/libbehaviortree_cpp.so ]] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: 'ros-industrial/industrial_ci@master' + env: ${{matrix.env}} + with: + package-name: behaviortree_cpp diff --git a/cmake/ament_build.cmake b/cmake/ament_build.cmake index 0bcfa64eb..6e74556e3 100644 --- a/cmake/ament_build.cmake +++ b/cmake/ament_build.cmake @@ -15,6 +15,16 @@ set( BTCPP_EXTRA_LIBRARIES ament_export_dependencies(ament_index_cpp) +# The ROS build farm (bloom/debhelper) configures with +# -DCMAKE_INSTALL_LIBDIR=lib/, but ament tooling +# (ament_export_libraries lookup, LD_LIBRARY_PATH environment hooks) +# only supports libraries installed to $prefix/lib. These plain set() +# calls intentionally shadow the GNUInstallDirs-based cache variables +# defined in the top-level CMakeLists.txt (see issue #1175). +set(BTCPP_LIB_DESTINATION lib) +set(BTCPP_INCLUDE_DESTINATION include) +set(BTCPP_BIN_DESTINATION bin) + mark_as_advanced( BTCPP_EXTRA_LIBRARIES BTCPP_EXTRA_INCLUDE_DIRS