You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using ros2 - foxy and want to build a colcon package written in C++, which includes the pcl_ros library. But somehow it can not find the libstatistics_collector libraries. For debugging reasons I just included the basics libraries to find the root cause of the problem.
The basic ROS2 node:
#include "rclcpp/rclcpp.hpp"
#include <sensor_msgs/msg/point_cloud2.hpp>
class LidarPerceptionNode : public rclcpp::Node
{
public:
LidarPerceptionNode() : Node("lidar_perception_node")
{
// Does nothing
}
private:
void topic_callback(const sensor_msgs::msg::PointCloud2::SharedPtr msg) const
{
// Does nothing
}
};
int main(int argc, char ** argv)
{
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<LidarPerceptionNode>());
rclcpp::shutdown();
return 0;
}
cmake_minimum_required(VERSION 3.5)
project(fs_zhaw_lidar_perception)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(PCL 1.8 REQUIRED)
find_package(pcl_ros REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
add_executable(lidar_perception_node src/lidar_perception_node.cpp)
target_include_directories(lidar_perception_node PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(lidar_perception_node "rclcpp" "pcl_ros")
install(TARGETS lidar_perception_node
DESTINATION lib/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
When I try to build it the package, I get an error msg:
CMake Error at CMakeLists.txt:26 (add_executable):
Target "lidar_perception_node" links to target
"libstatistics_collector::libstatistics_collector_test_msgs__rosidl_generator_c"
but the target was not found. Perhaps a find_package() call is missing for
an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:26 (add_executable):
Target "lidar_perception_node" links to target
"libstatistics_collector::libstatistics_collector_test_msgs__rosidl_typesupport_introspection_c"
but the target was not found. Perhaps a find_package() call is missing for
an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:26 (add_executable):
Target "lidar_perception_node" links to target
"libstatistics_collector::libstatistics_collector_test_msgs__rosidl_typesupport_c"
but the target was not found. Perhaps a find_package() call is missing for
an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:26 (add_executable):
Target "lidar_perception_node" links to target
"libstatistics_collector::libstatistics_collector_test_msgs__rosidl_generator_cpp"
but the target was not found. Perhaps a find_package() call is missing for
an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:26 (add_executable):
Target "lidar_perception_node" links to target
"libstatistics_collector::libstatistics_collector_test_msgs__rosidl_typesupport_introspection_cpp"
but the target was not found. Perhaps a find_package() call is missing for
an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:26 (add_executable):
Target "lidar_perception_node" links to target
"libstatistics_collector::libstatistics_collector_test_msgs__rosidl_typesupport_cpp"
but the target was not found. Perhaps a find_package() call is missing for
an IMPORTED target, or an ALIAS target is missing?
CMake Warning at CMakeLists.txt:26 (add_executable):
Cannot generate a safe runtime search path for target lidar_perception_node
because there is a cycle in the constraint graph:
dir 0 is [/opt/ros/foxy/lib]
dir 1 must precede it due to runtime library [liborocos-kdl.so.1.4]
dir 1 is [/home/florian/ros2_foxy/ros2-linux/lib]
dir 0 must precede it due to runtime library [libmessage_filters.so]
Some of these libraries may not be found correctly.
CMake Generate step failed. Build files cannot be regenerated correctly.
make: *** [Makefile:266: cmake_check_build_system] Error 1
---
Failed <<< fs_zhaw_lidar_perception [1.94s, exited with code 2]
I usually source foxy and build my packages like this:
When I remove the pcl_ros from the ament_target_dependencies() in the CMakeLists.txt, it compiles without any error. Do I source my foxy distribution wrongly or is there somewhere a bug?
Thanks in advance for the help!
The text was updated successfully, but these errors were encountered:
floriankittelmann
changed the title
Issues bulding own package when including pcl_ros / does not find
Issues bulding own package when including pcl_ros / does not find libstatistics_collector libraries
Apr 13, 2022
I am using ros2 - foxy and want to build a colcon package written in C++, which includes the pcl_ros library. But somehow it can not find the libstatistics_collector libraries. For debugging reasons I just included the basics libraries to find the root cause of the problem.
The basic ROS2 node:
The package.xml file:
My CMakeLists.txt
When I try to build it the package, I get an error msg:
I usually source foxy and build my packages like this:
When I remove the pcl_ros from the ament_target_dependencies() in the CMakeLists.txt, it compiles without any error. Do I source my foxy distribution wrongly or is there somewhere a bug?
Thanks in advance for the help!
The text was updated successfully, but these errors were encountered: