CMake Error at CMakeLists.txt:11 (find_package): By not providing “Findexample_ros2_interfaces/.cm

博客提及清除重复项时出现问题,报错后参考博客https://blog.youkuaiyun.com/qq_45701501/article/details/118598419,需在package.xml中添加内容。重写example_ros2_interfaces后出现Warning,但仍可使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.youkuaiyun.com/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]

交叉编译不能执行怎么办xy-shiqi@xyshiqi-vmware:~/ros2_ws/src/only-navigaton$ cd ~/ros2_ws rm -rf build_arm install_arm log xy-shiqi@xyshiqi-vmware:~/ros2_ws$ unset LD_LIBRARY_PATH xy-shiqi@xyshiqi-vmware:~/ros2_ws$ source /opt/poky/3.1.20/environment-setup-aarch64-poky-linux source /opt/ros/humble/setup.bash xy-shiqi@xyshiqi-vmware:~/ros2_ws$ source /opt/poky/3.1.20/environment-setup-aarch64-poky-linux Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH' but please check why this was set in the first place and that it's safe to unset. The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set. For more references see: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80 http://xahlee.info/UnixResource_dir/_/ldpath.html xy-shiqi@xyshiqi-vmware:~/ros2_ws$ source /opt/poky/3.1.20/environment-setup-aarch64-poky-linux Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH' but please check why this was set in the first place and that it's safe to unset. The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set. For more references see: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80 http://xahlee.info/UnixResource_dir/_/ldpath.html xy-shiqi@xyshiqi-vmware:~/ros2_ws$ source /opt/ros/humble/setup.bash xy-shiqi@xyshiqi-vmware:~/ros2_ws$ colcon build \ --build-base build_arm \ --install-base install_arm \ --merge-install \ --cmake-args \ -DCMAKE_TOOLCHAIN_FILE=/opt/poky/3.1.20/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake Starting >>> only-navigaton --- stderr: only-navigaton CMake Error at /opt/ros/humble/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package): By not providing "Findament_cmake_export_interfaces.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "ament_cmake_export_interfaces", but CMake did not find one. Could not find a package configuration file provided by "ament_cmake_export_interfaces" with any of the following names: ament_cmake_export_interfacesConfig.cmake ament_cmake_export_interfaces-config.cmake Add the installation prefix of "ament_cmake_export_interfaces" to CMAKE_PREFIX_PATH or set "ament_cmake_export_interfaces_DIR" to a directory containing one of the above files. If "ament_cmake_export_interfaces" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): /opt/ros/humble/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include) CMakeLists.txt:31 (find_package) --- Failed <<< only-navigaton [0.54s, exited with code 1] Summary: 0 packages finished [0.76s] 1 package failed: only-navigaton 1 package had stderr output: only-navigaton xy-shiqi@xyshiqi-vmware:~/ros2_ws$
07-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值