Skip to content

Pin ament install destinations to lib/include/bin (fixes #1175)#1176

Merged
facontidavide merged 1 commit into
masterfrom
fix/1175-ament-install-path
Jul 22, 2026
Merged

Pin ament install destinations to lib/include/bin (fixes #1175)#1176
facontidavide merged 1 commit into
masterfrom
fix/1175-ament-install-path

Conversation

@facontidavide

Copy link
Copy Markdown
Collaborator

Fixes #1175

Problem

Since #1152, the BTCPP_*_DESTINATION variables honor CMAKE_INSTALL_LIBDIR (GNUInstallDirs). The ROS build farm (bloom/debhelper) always configures with -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu, so the Lyrical/Rolling binaries started installing libbehaviortree_cpp.so to /opt/ros/<distro>/lib/x86_64-linux-gnu/ instead of /opt/ros/<distro>/lib/.

That path breaks ROS in two independent ways:

  • Configure time: the extras file generated by ament_export_libraries() hardcodes find_library(... PATHS "${prefix}/../../../lib" NO_DEFAULT_PATH), so downstream find_package(behaviortree_cpp) fails (see ament_cmake_export_libraries fails when CMAKE_INSTALL_LIBDIR is set ament/ament_cmake#630, e.g. the auto_apms_behavior_tree_core farm failure).
  • Runtime: the ament environment hooks only put $prefix/lib on LD_LIBRARY_PATH, and ldconfig does not index /opt paths — so even with the ament fix, binaries would not find the library. This is why fixing ament alone is not sufficient and BT.CPP must pin the path itself.

Solution

Plain set() calls in cmake/ament_build.cmake shadow the GNUInstallDirs-based cache variables whenever the ament build path is active, pinning the destinations to lib/include/bin regardless of what debhelper injects. Standalone (non-ROS) builds are untouched and keep the override behavior introduced for #1120.

Also adds a ros2-lyrical CI job (industrial_ci, same pattern as humble/jazzy) that emulates the build farm by passing TARGET_CMAKE_ARGS: -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu, with an AFTER_SCRIPT asserting the library lands in install/behaviortree_cpp/lib/ — a permanent regression test for this issue.

Verified (locally against /opt/ros/lyrical)

Scenario Result
ament + -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu (farm emulation) installs to lib
staging cmake --install layout lib/libbehaviortree_cpp.so, no multiarch dir ✅
full test suite (ament build) 100% passed ✅
non-ament + -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu (#1120 feature) lib/x86_64-linux-gnu
non-ament + -DBTCPP_LIB_DESTINATION=custom/lib custom/lib

API / ABI

Build-system change only; no API or ABI impact. Restores the pre-4.9.1 install layout for ROS binaries — needs a 4.9.2 patch release + bloom re-release for the affected distros.

🤖 Generated with Claude Code

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>
@sonarqubecloud

Copy link
Copy Markdown

@facontidavide
facontidavide merged commit bce9241 into master Jul 22, 2026
17 checks passed
@facontidavide
facontidavide deleted the fix/1175-ament-install-path branch July 22, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PR #1152 Breaks ROS Build Farm Binaries

1 participant