ROS2 ament_cmake_librariesConfig.cmake "include could not load file: "
I have recently installed ROS2 on my ubuntu 20.04 machine. I initially was doing the simple publisher tutorial with rclcpp and had no issues with cmake what so ever. Once I tried to add a subscriber in my package and the subsequent cmake to support it I keep getting this weird error. I included my cmakelist.txt and the error output - sorry for the bad format - not soo sure how to format this stuff. (I also made sure to source setup my environment)
Starting >>> first_package
--- stderr: first_package
CMake Error at /home/niiquaye/ros2_foxy_training/install/ament_cmake_libraries/share/ament_cmake_libraries/cmake/ament_cmake_librariesConfig.cmake:41 (include):
include could not find load file:
/home/niiquaye/ros2_foxy_training/install/ament_cmake_libraries/share/ament_cmake_libraries/cmake/ament_cmake_libraries-extras.cmake
Call Stack (most recent call first):
/home/niiquaye/ros2_foxy_training/install/ament_cmake/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:5 (find_package)
/home/niiquaye/ros2_foxy_training/install/ament_cmake/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
CMakeLists.txt:19 (find_package)
CMakeLists.txt
make_minimum_required(VERSION 3.5)
project(first_package)
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
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_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
add_executable(talker src/publisher_member_function.cpp)
ament_target_dependencies(talker rclcpp std_msgs)
add_executable(listener src/subscriber_member_function.cpp)
ament_target_dependencies(listener rclcpp std_msgs)
install(TARGETS
talker
listener
DESTINATION lib/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
I made sure to source setup my terminal
Welcome to ROS Answers! Most regular markdown works here, so you can format blocks of code or blocks of terminal output by putting them between three backticks:
Or indent the blocks with 4 spaces. That's also what happens if you click the 'preformatted text' button in the toolbar of the editor (the one with the 1s and 0s on it)
Thank you!
@sgvandijk I've found that using the three backticks quite often still results in unreadable text and just use the preformatted text button which works well most of the time (at least more often than any other method)
Actually I found the same just after posting that yeah... the three backticks don't work well. Best is to use 4 spaces of indentation for each line of the block, which is what the preformatted text button does.