rr-aiden
rr-aiden

Reputation: 1

Linking OGRE with ROS2 Humble Project

I'm in the process of migrating a codebase from ROS1 Noetic to ROS2 Humble using Ubuntu 22.04. In the process of this migration, I am transitioning from RViz to RViz2. In ROS1, I was using OGRE as a dependency, though it was transitively installed by RViz and I did not need to include it in my CMakeLists.txt. In RViz2, this has not happened. I've installed libogre-1.12-dev, and linked my library against this; however, I'm not facing issues with linking OGRE's plugins.

--- stderr: ns_ui_common                                
optimized/usr/lib/x86_64-linux-gnu/libOgreMain.sodebug/usr/lib/x86_64-linux-gnu/libOgreMain.so
/opt/ros/humble/opt/rviz_ogre_vendor/lib/opt/ros/humble/opt/rviz_ogre_vendor/lib/OGRE
/usr/bin/ld: cannot find -lPlugin_BSPSceneManager: No such file or directory
/usr/bin/ld: cannot find -lPlugin_OctreeSceneManager: No such file or directory
/usr/bin/ld: cannot find -lPlugin_PCZSceneManager: No such file or directory
/usr/bin/ld: cannot find -lPlugin_ParticleFX: No such file or directory
/usr/bin/ld: cannot find -lRenderSystem_GL: No such file or directory
/usr/bin/ld: cannot find -lRenderSystem_GL3Plus: No such file or directory
/usr/bin/ld: cannot find -lCodec_STBI: No such file or directory
/usr/bin/ld: cannot find -lPlugin_BSPSceneManager: No such file or directory
/usr/bin/ld: cannot find -lPlugin_OctreeSceneManager: No such file or directory
/usr/bin/ld: cannot find -lPlugin_PCZSceneManager: No such file or directory
/usr/bin/ld: cannot find -lPlugin_ParticleFX: No such file or directory
/usr/bin/ld: cannot find -lRenderSystem_GL: No such file or directory
/usr/bin/ld: cannot find -lRenderSystem_GL3Plus: No such file or directory
/usr/bin/ld: cannot find -lCodec_STBI: No such file or directory
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/ns_ui_common_utils_lib.dir/build.make:542: libns_ui_common_utils_lib.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/ns_ui_common_utils_lib.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2

I've tried to replicate a minimal viable CMakeLists.txt which can reproduce the issue as a lot of the file needs to be redacted:

cmake_minimum_required(VERSION 3.5)
project(ns_ui_common)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../development/config/colcon_defaults.cmake)

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rviz2 REQUIRED)

set(OGRE_CMAKE_PATH "/usr/share/OGRE/cmake/modules")
set(CMAKE_MODULE_PATH "${OGRE_CMAKE_PATH};${CMAKE_MODULE_PATH}")
find_package(OGRE REQUIRED)

ament_export_dependencies(
    rviz2
    OGRE
)

add_library(${PROJECT_NAME}_utils_lib
    src/utils.cpp
)
ament_target_dependencies(${PROJECT_NAME}_utils_lib rviz_common OGRE)
ament_export_targets(${PROJECT_NAME}_utils_lib_${TARGET_SUFFIX} HAS_LIBRARY_TARGET)
target_link_libraries(${PROJECT_NAME}_utils_lib ${OGRE_LIBRARIES})
ns_include(${PROJECT_NAME}_utils_lib)
ns_install(${PROJECT_NAME}_utils_lib)

install(
  DIRECTORY include/
  DESTINATION include
)

ament_package()

I can confirm that OGRE is found, and the OGRE_LIBRARIES, OGRE_LIBRARY_DIR and OGRE_PLUGIN_DIR all consist of the correct fields and information.

OGRE_LIBRARY=optimized/usr/lib/x86_64-linux-gnu/libOgreMain.sodebug/usr/lib/x86_64-linux-gnu/libOgreMain.so OGRE_LIBRARY_DIRS=/opt/ros/humble/opt/rviz_ogre_vendor/lib/opt/ros/humble/opt/rviz_ogre_vendor/lib/OGRE OGRE_LIBRARIES=OgreHLMSOgreMeshLodGeneratorOgreOverlayOgrePagingOgrePropertyOgreRTShaderSystemOgreTerrainOgreVolumeOgreMainPlugin_BSPSceneManagerPlugin_OctreeSceneManagerPlugin_PCZSceneManagerPlugin_ParticleFXRenderSystem_GLRenderSystem_GL3PlusCodec_STBI OGRE_PLUGIN_DIR=/opt/ros/humble/opt/rviz_ogre_vendor/lib/OGRE

I've tried using target_link_directories(ns_ui_common_utils_lib PUBLIC ${OGRE_LIBRARIES}) and link_directories(/opt/ros/humble/opt/rviz_ogre_vendor/lib/OGRE) with no avail.

The plugins and the libraries all seem correctly installed:

user:~/home/user$ ls /opt/ros/humble/opt/rviz_ogre_vendor/lib/
OGRE/                              libOgrePaging.so.1.12.1
libOgreGLSupport.a                 libOgreProperty.so
libOgreHLMS.so                     libOgreProperty.so.1.12.1
libOgreHLMS.so.1.12.1              libOgreRTShaderSystem.so
libOgreMain.so                     libOgreRTShaderSystem.so.1.12.1
libOgreMain.so.1.12.1              libOgreTerrain.so
libOgreMeshLodGenerator.so         libOgreTerrain.so.1.12.1
libOgreMeshLodGenerator.so.1.12.1  libOgreVolume.so
libOgreOverlay.so                  libOgreVolume.so.1.12.1
libOgreOverlay.so.1.12.1           pkgconfig/
libOgrePaging.so       
            
user:~/home/user$ ls /opt/ros/humble/opt/rviz_ogre_vendor/lib/OGRE/
Codec_STBI.so                        Plugin_PCZSceneManager.so.1.12.1
Codec_STBI.so.1.12.1                 Plugin_ParticleFX.so
Plugin_BSPSceneManager.so            Plugin_ParticleFX.so.1.12.1
Plugin_BSPSceneManager.so.1.12.1     RenderSystem_GL.so
Plugin_OctreeSceneManager.so         RenderSystem_GL.so.1.12.1
Plugin_OctreeSceneManager.so.1.12.1  RenderSystem_GL3Plus.so
Plugin_OctreeZone.so                 RenderSystem_GL3Plus.so.1.12.1
Plugin_OctreeZone.so.1.12.1          cmake/
Plugin_PCZSceneManager.so            


Any further suggestions would be greatly appreciated.

Upvotes: 0

Views: 172

Answers (0)

Related Questions