Skip to content

Build error when using ament_python_install_package() and generated interfaces #141

Closed as not planned
@jtbandes

Description

@jtbandes

Originally posted by @jacobperron in #131 (comment):

This change [#131] prevents a package from building if it both generates interfaces and installs a Python package. For example, I have a package that is not longer building since it does something like this:

rosidl_generate_interfaces(${PROJECT_NAME}_msgs
  ...
)

ament_python_install_package(${PROJECT_NAME})

I see an error like:

CMake Error at /home/jacob/ros2-linux/share/ament_cmake_python/cmake/ament_python_install_package.cmake:108 (add_custom_target):
  add_custom_target cannot create target
  "ament_cmake_python_symlink_my_package" because another target with the
  same name already exists.  The existing target is a custom target created
  in source directory
  ...

I'm running into this issue in rosbridge_suite as well when building for Rolling: RobotWebTools/rosbridge_suite#581

One thing I don't understand is why this error appears for rosapi, but not rosbridge_library.

I'm a CMake noob, but would it be possible to simply pass a different, unique target name on this line instead of just ${PROJECT_NAME}?

if(NOT rosidl_generate_interfaces_SKIP_INSTALL)
ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_output_path}")
endif()

(Meta-question: is there anything we could have done in either the rosbridge_suite repo or this repo to catch this kind of failure sooner, and not have to wait for another Rolling release to incorporate a fix into rosbridge_suite? Asking because I'm still learning about the release process, having recently taken on some maintenance of rosbridge_suite for ROS 2 compatibility.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions