Problem with dependencies between multiple packages in colcon build

asked 2021-10-01 07:15:10 -0600

max11gen gravatar image

updated 2021-10-01 07:24:07 -0600

When invoking colcon build in my workspace, I get multiple errors like this:

CMake Error at /home/max/colcon_ws/install/naturetec_drone_com_interfaces/share/naturetec_drone_com_interfaces/cmake/ament_cmake_export_dependencies-extras.cmake:39 (get_target_property):
  get_target_property called with incorrect number of arguments
Call Stack (most recent call first):
  /home/max/colcon_ws/install/naturetec_drone_com_interfaces/share/naturetec_drone_com_interfaces/cmake/naturetec_drone_com_interfacesConfig.cmake:41 (include)
  CMakeLists.txt:22 (find_package)

The error appears when building my package naturetec_drone_com which depends on naturetec_drone_com_interfaces which depends on px4_msgs. It's about 30 messages all saying exactly the same except for the line number in ament_cmake_export_dependencies-extras.cmake. The error started appearing when I added

rosidl_generate_interfaces(${PROJECT_NAME}
  "msg/MissionWaypoints.msg"
  DEPENDENCIES px4_msgs
 )

to the CMakeLists of naturetec_drone_com_interfaces. Or more specifically, I only added the DEPENDENCIES px4_msgs.

Any idea on what I am doing wrong?

Here are the CMakeLists.txt files of the two packages:

naturec_drone_com/CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(naturetec_drone_com)

# 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(px4_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(naturetec_drone_com_interfaces REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

include_directories(include)

add_executable(mission_creator
    src/mission_creator.cpp
    )
ament_target_dependencies(mission_creator
    rclcpp
    px4_msgs
    naturetec_drone_com_interfaces
)

add_executable(vehicle_onboard_node
    src/vehicle.cpp
    )
ament_target_dependencies(vehicle_onboard_node
    rclcpp
    px4_msgs
    naturetec_drone_com_interfaces
    )

add_executable(vehicle_test_publisher
    src/vehicle_test_publisher
    )
ament_target_dependencies(vehicle_test_publisher
    rclcpp
    px4_msgs
    naturetec_drone_com_interfaces
    )

add_executable(battery_publisher
    src/battery_publisher.cpp)
ament_target_dependencies(battery_publisher
    rclcpp
    px4_msgs
)

install(TARGETS
    mission_creator
    battery_publisher
    vehicle_onboard_node
    vehicle_test_publisher
    DESTINATION lib/${PROJECT_NAME}
    )

naturetec_drone_com_interfaces/CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(naturetec_drone_com_interfaces)

# 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(rosidl_default_generators REQUIRED)
find_package(px4_msgs REQUIRED)

include_directories(${px4_msgs_INCLUDE_DIRS})

rosidl_generate_interfaces(${PROJECT_NAME}
  "msg/MissionWaypoints.msg"
  DEPENDENCIES px4_msgs
 )

ament_export_dependencies(rosidl_default_runtime)

ament_package()
edit retag flag offensive close merge delete

Comments

Does the package.xml for naturetec_drone_com_interfaces have <exec_depend>rosidl_default_runtime</exec_depend>? Are you sure ros-foxy-rosidl-default-runtime is installed or built in your colcon workspace?

cottsay gravatar image cottsay  ( 2021-10-28 00:50:39 -0600 )edit