build: use robot_sbpl; find the abort-flag probe under RTLD_LOCAL

- Standalone build: when the pnkx_nav_core root CMakeLists has built the
  robot_sbpl target, link it directly, so the header and the library come
  from one source tree. The standalone branch did not link SBPL at all
  before.
- Catkin build: use the installed robot_sbpl package (robot_sbpl_DIR). An
  old install named sbpl still builds, with a warning that ros-noetic-sbpl
  can shadow it at runtime.
- boost::dll loads plugins RTLD_LOCAL, so libsbpl is not in the global
  scope and dlsym(RTLD_DEFAULT) never found sbpl_abort_flag_abi_version,
  even with the right library loaded. Fall back to RTLD_NEXT, which
  searches this plugin's own dependencies.
This commit is contained in:
2026-10-21 14:51:46 +07:00
parent d3a9b3f271
commit c98a5acf44
2 changed files with 42 additions and 15 deletions

View File

@@ -394,7 +394,12 @@ bool SBPLLatticePlanner::initialize(std::string name, robot_costmap_2d::Costmap2
#ifdef SBPL_HAS_ABORT_FLAG
{
using ProbeFn = int (*)();
// boost::dll nạp plugin với RTLD_LOCAL, nên librobot_sbpl (dependency của .so này) không nằm
// trong global scope và RTLD_DEFAULT không thấy nó dù đúng bản. RTLD_NEXT tra tiếp các
// dependency của chính .so này.
void* sym = dlsym(RTLD_DEFAULT, "sbpl_abort_flag_abi_version");
if (sym == nullptr)
sym = dlsym(RTLD_NEXT, "sbpl_abort_flag_abi_version");
if (sym != nullptr && reinterpret_cast<ProbeFn>(sym)() == SBPL_ABORT_FLAG_ABI_VERSION)
{
sbpl_abort_supported_ = true;