I've had this issue multiple times with different libraries. The colcon build
runs fine but at launch ros2 complaints that the shared objects were not found. Is there a better way to add the path other than setting $LD_LIBRARY_PATH
env variable?
I link the external libraries (eg: libtorch) in cmake as
target_link_libraries(some_proj
${TORCH_LIBRARIES}
)
install(TARGETS some_proj
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/
)
ament_package()