Description:
I was installing the Autonomous Exploration Development Environment, where the non-planner validation demo worked well. However, I encounted some problems when I wanted to install this planner.
Environment:
- Ubuntu 22.04
- ROS2 Humble
- GCC/G++ 11.4
- CMake 3.22
- Building
dsv_planner (depends on octomap_world)
Problem:
When building dsv_planner, linking fails with multiple undefined references to octomap::... and octomath::....
Example error:
/usr/bin/ld: /home/.../liboctomap_world.so: undefined reference to `octomap::Pointcloud::~Pointcloud()'
/usr/bin/ld: /home/.../liboctomap_world.so: undefined reference to `octomap::AbstractOccupancyOcTree::readBinary(...)'
collect2: error: ld returned 1 exit status
Root cause:
The octomap_world library does not link against OctoMap core libraries (liboctomap.so, liboctomath.so).
While ament_target_dependencies(${PROJECT_NAME} octomap ...) is present, it does not add system-level OctoMap libraries to the linker command.
How to reproduce:
-
Fresh ROS2 Humble setup on Ubuntu 22.04
-
Install dependencies as listed in the official setup notes:
sudo apt install ros-humble-octomap-ros libgoogle-glog-dev libgflags-dev
-
Build dsv_planner:
colcon build --symlink-install --packages-select dsvplanner
-
Observe undefined reference errors from liboctomap_world.so.
Proposed fix:
In
src/volumetric_mapping/octomap_world/CMakeLists.txt,
add explicit OctoMap linkage after ament_target_dependencies():
find_package(octomap REQUIRED)
target_link_libraries(${PROJECT_NAME}
${PCL_LIBRARIES}
${OCTOMAP_LIBRARIES} # Ensures liboctomap.so and liboctomath.so are linked
)
Verification:
After patching:
ldd install/octomap_world/lib/liboctomap_world.so | grep octomap
Outputs:
liboctomap.so => /usr/lib/x86_64-linux-gnu/liboctomap.so
liboctomath.so => /usr/lib/x86_64-linux-gnu/liboctomath.so
Then, dsv_planner builds successfully, and the exploration demo runs without errors.
Additional notes:
- Also,
liboctomap-dev is required in addition to ros-humble-octomap-ros, but not mentioned in the setup notes.
It provides liboctomap.so and liboctomath.so.
- The fix is backward compatible and safe for both ROS2 Humble and Jazzy.
(the mainbody was generated with GPT, so if something unclear pls leave a message)
Description:
I was installing the Autonomous Exploration Development Environment, where the non-planner validation demo worked well. However, I encounted some problems when I wanted to install this planner.
Environment:
dsv_planner(depends onoctomap_world)Problem:
When building
dsv_planner, linking fails with multiple undefined references tooctomap::...andoctomath::....Example error:
Root cause:
The
octomap_worldlibrary does not link against OctoMap core libraries (liboctomap.so,liboctomath.so).While
ament_target_dependencies(${PROJECT_NAME} octomap ...)is present, it does not add system-level OctoMap libraries to the linker command.How to reproduce:
Fresh ROS2 Humble setup on Ubuntu 22.04
Install dependencies as listed in the official setup notes:
Build
dsv_planner:Observe undefined reference errors from
liboctomap_world.so.Proposed fix:
In
src/volumetric_mapping/octomap_world/CMakeLists.txt,add explicit OctoMap linkage after
ament_target_dependencies():Verification:
After patching:
ldd install/octomap_world/lib/liboctomap_world.so | grep octomapOutputs:
Then,
dsv_plannerbuilds successfully, and the exploration demo runs without errors.Additional notes:
liboctomap-devis required in addition toros-humble-octomap-ros, but not mentioned in the setup notes.It provides
liboctomap.soandliboctomath.so.(the mainbody was generated with GPT, so if something unclear pls leave a message)