jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.91k stars 1.77k forks source link

Building robot_localization pkg error with yaml-cpp target not found #1280

Open iyhabz opened 1 month ago

iyhabz commented 1 month ago

Hey i am trying to build the robot_localization pkg and keep having the error regarding the yaml-cpp pkg

CMake Error at CMakeLists.txt:82 (add_executable):
  Target "ekf_node" links to target "yaml-cpp::yaml-cpp" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

Full Error message

Starting >>> robot_localization
--- stderr: robot_localization                                                                            
CMake Error at CMakeLists.txt:67 (add_library):
  Target "rl_lib" links to target "yaml-cpp::yaml-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:82 (add_executable):
  Target "ekf_node" links to target "yaml-cpp::yaml-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:87 (add_executable):
  Target "ukf_node" links to target "yaml-cpp::yaml-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:92 (add_executable):
  Target "navsat_transform_node" links to target "yaml-cpp::yaml-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:97 (add_executable):
  Target "robot_localization_listener_node" links to target
  "yaml-cpp::yaml-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:97 (add_executable):
  Target "robot_localization_listener_node" links to target
  "yaml-cpp::yaml-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 /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "filter_base-test" links to target "yaml-cpp::yaml-cpp" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest.cmake:68 (ament_add_gtest_executable)
  CMakeLists.txt:178 (ament_add_gtest)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_filter_base_diagnostics_timestamps" links to target
  "yaml-cpp::yaml-cpp" but the target was not found.  Perhaps a
  find_package() call is missing for an IMPORTED target, or an ALIAS target
  is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  CMakeLists.txt:182 (ament_add_gtest_executable)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_ekf" links to target "yaml-cpp::yaml-cpp" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest.cmake:68 (ament_add_gtest_executable)
  CMakeLists.txt:198 (ament_add_gtest)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_ekf_node_interfaces" links to target "yaml-cpp::yaml-cpp" but
  the target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  CMakeLists.txt:204 (ament_add_gtest_executable)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_ukf" links to target "yaml-cpp::yaml-cpp" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest.cmake:68 (ament_add_gtest_executable)
  CMakeLists.txt:230 (ament_add_gtest)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_ukf_node_interfaces" links to target "yaml-cpp::yaml-cpp" but
  the target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  CMakeLists.txt:236 (ament_add_gtest_executable)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_robot_localization_estimator" links to target
  "yaml-cpp::yaml-cpp" but the target was not found.  Perhaps a
  find_package() call is missing for an IMPORTED target, or an ALIAS target
  is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  CMakeLists.txt:281 (ament_add_gtest_executable)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_navsat_conversions" links to target "yaml-cpp::yaml-cpp" but
  the target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest.cmake:68 (ament_add_gtest_executable)
  CMakeLists.txt:294 (ament_add_gtest)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_ros_robot_localization_listener" links to target
  "yaml-cpp::yaml-cpp" but the target was not found.  Perhaps a
  find_package() call is missing for an IMPORTED target, or an ALIAS target
  is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  CMakeLists.txt:297 (ament_add_gtest_executable)

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_ros_robot_localization_listener_publisher" links to target
  "yaml-cpp::yaml-cpp" but the target was not found.  Perhaps a
  find_package() call is missing for an IMPORTED target, or an ALIAS target
  is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  CMakeLists.txt:302 (ament_add_gtest_executable)

CMake Generate step failed.  Build files cannot be regenerated correctly.
---
Failed   <<< robot_localization [8.41s, exited with code 1]

has any one faced an issue like this?

thanks in advance

AntoineLevanen commented 1 month ago

Hello, You need to tell your CMake file where is the yaml-cpp library in order to successfully build the ROS robot_localization package. The README of this repository give an explanation on how to include the yaml-cpp library to your C++ project here.
You can add this before the find_package() of your CMake file (don't forget to speciffy the GIT_TAG argument).