Starting >>> example_interfaces_rclcpp
--- stderr: example_interfaces_rclcpp
CMake Error at CMakeLists.txt:11 (find_package):
By not providing "Findexample_ros2_interfaces/.cmake" in CMAKE_MODULE_PATH
this project has asked CMake to find a package configuration file provided
by "example_ros2_interfaces/", but CMake did not find one.
Could not find a package configuration file provided by
"example_ros2_interfaces/" with any of the following names:
example_ros2_interfaces/Config.cmake
example_ros2_interfaces/-config.cmake
Add the installation prefix of "example_ros2_interfaces/" to
CMAKE_PREFIX_PATH or set "example_ros2_interfaces/_DIR" to a directory
containing one of the above files. If "example_ros2_interfaces/" provides
a separate development package or SDK, be sure it has been installed.
---
Failed <<< example_interfaces_rclcpp [1.14s, exited with code 1]
source install/setup.zsh
后报错如下:
--- stderr: example_interfaces_rclcpp
CMake Error at /opt/ros/humble/share/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake:77 (message):
ament_target_dependencies() the passed package name
'example_ros2_interfaces/' was not found before
Call Stack (most recent call first):
CMakeLists.txt:18 (ament_target_dependencies)
ros2 interface list| grep example_ros2_interfaces
找不到
参考博客https://blog.csdn.net/qq_45701501/article/details/118598419
在package.xml中添加如下内容:
<build_depend>rosidl_default_generators</build_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
colcon build
报错如下:
Starting >>> example_ros2_interfaces
--- stderr: example_ros2_interfaces
Error parsing '/home/gkj/d2lros2/chapt3/chapt3_ws/src/example_ros2_interfaces/package.xml':
Traceback (most recent call last):
File "/opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 150, in <module>
main()
File "/opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 53, in main
raise e
File "/opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 49, in main
package = parse_package_string(
File "/home/gkj/.local/lib/python3.10/site-packages/catkin_pkg/package.py", line 786, in parse_package_string
raise InvalidPackage('Error(s):%s' % (''.join(['\n- %s' % e for e in errors])), filename)
catkin_pkg.package.InvalidPackage: Error(s) in package '/home/gkj/d2lros2/chapt3/chapt3_ws/src/example_ros2_interfaces/package.xml':
Error(s):
- The generic dependency on 'rosidl_default_generators' is redundant with: build_depend
CMake Error at /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
execute_process(/home/gkj/miniconda3/bin/python3.10
/opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
/home/gkj/d2lros2/chapt3/chapt3_ws/src/example_ros2_interfaces/package.xml
/home/gkj/d2lros2/chapt3/build/example_ros2_interfaces/ament_cmake_core/package.cmake)
returned error code 1
Call Stack (most recent call first):
/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:226 (ament_package_xml)
CMakeLists.txt:13 (rosidl_generate_interfaces)
---
Failed <<< example_ros2_interfaces [0.76s, exited with code 1]
重写example_ros2_interfaces
Starting >>> example_ros2_interfaces
--- stderr: example_ros2_interfaces
CMake Warning at /opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:166 (add_library):
Cannot generate a safe runtime search path for target
example_ros2_interfaces__rosidl_generator_py because files in some
directories may conflict with libraries in implicit directories:
runtime library [libpython3.10.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/gkj/miniconda3/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:14 (rosidl_generate_interfaces)
CMake Warning at /opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:226 (add_library):
Cannot generate a safe runtime search path for target
example_ros2_interfaces__rosidl_typesupport_fastrtps_c__pyext because files
in some directories may conflict with libraries in implicit directories:
runtime library [libpython3.10.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/gkj/miniconda3/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:14 (rosidl_generate_interfaces)
CMake Warning at /opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:226 (add_library):
Cannot generate a safe runtime search path for target
example_ros2_interfaces__rosidl_typesupport_introspection_c__pyext because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libpython3.10.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/gkj/miniconda3/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:14 (rosidl_generate_interfaces)
CMake Warning at /opt/ros/humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:226 (add_library):
Cannot generate a safe runtime search path for target
example_ros2_interfaces__rosidl_typesupport_c__pyext because files in some
directories may conflict with libraries in implicit directories:
runtime library [libpython3.10.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/gkj/miniconda3/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
/opt/ros/humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:14 (rosidl_generate_interfaces)
---
Finished <<< example_ros2_interfaces [3.20s]
Summary: 1 package finished [3.58s]
1 package had stderr output: example_ros2_interfaces
清除重复项
出现Warning,但能用,凑合用着
--- stderr: example_interfaces_rclcpp
CMake Warning at CMakeLists.txt:13 (add_executable):
Cannot generate a safe runtime search path for target
example_interfaces_robot_01 because files in some directories may conflict
with libraries in implicit directories:
runtime library [libpython3.10.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/gkj/miniconda3/lib
Some of these libraries may not be found correctly.
CMake Warning at CMakeLists.txt:30 (add_executable):
Cannot generate a safe runtime search path for target
example_interfaces_control_01 because files in some directories may
conflict with libraries in implicit directories:
runtime library [libpython3.10.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/gkj/miniconda3/lib
Some of these libraries may not be found correctly.
---
Finished <<< example_interfaces_rclcpp [2.43s]