Skip to content

Commit bce9241

Browse files
Pin ament install destinations to lib/include/bin (fixes #1175) (#1176)
The ROS build farm (bloom/debhelper) configures with -DCMAKE_INSTALL_LIBDIR=lib/<multiarch-triplet>. Since #1152 made the BTCPP_*_DESTINATION variables honor GNUInstallDirs, farm binaries installed libbehaviortree_cpp.so to /opt/ros/<distro>/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 <noreply@anthropic.com>
1 parent c091696 commit bce9241

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: ros2-lyrical
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
industrial_ci:
16+
strategy:
17+
matrix:
18+
env:
19+
# TARGET_CMAKE_ARGS emulates the ROS build farm (bloom/debhelper),
20+
# which configures with -DCMAKE_INSTALL_LIBDIR=lib/<multiarch>.
21+
# AFTER_SCRIPT asserts that the library is still installed to
22+
# $prefix/lib, as required by ament tooling (see issue #1175).
23+
- ROS_DISTRO: lyrical
24+
ROS_REPO: main
25+
TARGET_CMAKE_ARGS: -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu
26+
AFTER_SCRIPT: >-
27+
lib=$(find "$BASEDIR/target_ws/install" -name libbehaviortree_cpp.so);
28+
echo "libbehaviortree_cpp.so installed at: ${lib:-NOT FOUND}";
29+
[[ "$lib" == */install/behaviortree_cpp/lib/libbehaviortree_cpp.so ]]
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v7
33+
- uses: 'ros-industrial/industrial_ci@master'
34+
env: ${{matrix.env}}
35+
with:
36+
package-name: behaviortree_cpp

‎cmake/ament_build.cmake‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ set( BTCPP_EXTRA_LIBRARIES
1515

1616
ament_export_dependencies(ament_index_cpp)
1717

18+
# The ROS build farm (bloom/debhelper) configures with
19+
# -DCMAKE_INSTALL_LIBDIR=lib/<multiarch-triplet>, but ament tooling
20+
# (ament_export_libraries lookup, LD_LIBRARY_PATH environment hooks)
21+
# only supports libraries installed to $prefix/lib. These plain set()
22+
# calls intentionally shadow the GNUInstallDirs-based cache variables
23+
# defined in the top-level CMakeLists.txt (see issue #1175).
24+
set(BTCPP_LIB_DESTINATION lib)
25+
set(BTCPP_INCLUDE_DESTINATION include)
26+
set(BTCPP_BIN_DESTINATION bin)
27+
1828
mark_as_advanced(
1929
BTCPP_EXTRA_LIBRARIES
2030
BTCPP_EXTRA_INCLUDE_DIRS

0 commit comments

Comments
 (0)