ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

cmake errors when compiling ros_comm from source

asked 2017-07-05 21:17:22 -0500

xtracrispy gravatar image

updated 2017-07-06 01:40:08 -0500

gvdhoorn gravatar image


I am trying to build ros_comm from source, since I am on a platform which has boost 1.62 and the downloaded package for my arm64 architecture is seemingly stuck at 1.58.

My nodes compile beautifully if I ignore the warnings and use the repo packages (apt-get ros-kinetic-ros-comm), but fails when I try to fix the boost warnings by compiling by source.

The message I get is:

CMake Error at /ws/build/ros_comm/clients/roscpp/cmake/roscpp-genmsg.cmake:79 (add_custom_target):
  add_custom_target cannot create target "roscpp_generate_messages_cpp"
  because another target with the same name already exists.  The existing
  target is a custom target created in source directory
  "/ws/src/my_node".  See documentation for policy
  CMP0002 for more details.

Call Stack (most recent call first):
  /opt/ros/kinetic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
  ros_comm/clients/roscpp/CMakeLists.txt:39 (generate_messages)

It feels like it's conflicting with the original installation somehow, but I've already tried apt-get removing the original.

What's the best way to fix this error?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-05 22:17:47 -0500

xtracrispy gravatar image

updated 2017-07-06 01:40:22 -0500

gvdhoorn gravatar image

Going to answer my question in case anybody else comes across this. The problem turned out to be that in my cmakefiles, I did not properly set up my node's dependency on roscpp. As a result, it wouldn't build roscpp first, and hence the conflict.

issue was resolved by:

  • adding roscpp, and some messages to find_package
  • adding roscpp as a CATKIN_DEPENDS to catkin_package()
  • adding roscpp_generate_messages_cpp as an add_dependency
  • adding msgs & roscpp as build_depends & run_depends in package.xml
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-07-05 21:17:22 -0500

Seen: 427 times

Last updated: Jul 06 '17