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

How to have 2 almost same packages together in workspace?

asked 2016-09-03 21:14:00 -0500

Nanoha gravatar image

I'm taking over my predecessor's job of ROS. My predecessor gave me ROS codes as a ROS package.

I want to have in my workspace both of his original package and another package which I add changes to, so that I can always execute them and compare their behavior difference.

I tried the following procedure but got errors.

Let his original package be "original_package" and my working package be "my_package".

  1. In ~/catkin_ws/src/, execute 'cp -r original_package my_package'
  2. In ~/catkin_ws/src/my_package/CMakeList.txt and package.xml, replaced "original_package" with "my_package"
  3. In ~/cakin_ws/, execute 'catkin_make -B' (-B is just a option to build all things forcely)

But cakin said errors like below. Obviously this is due to both 2 packages have the same-name modules.

CMake Error at my_package/CMakeLists.txt:134 (add_executable): add_executable cannot create target "module-name" because another target with the same name already exists. The existing target is an executable created in source directory "~/cakin_ws/src/original_package". See documentation for policy CMP0002 for more details.

CMake Error at my_package/CMakeLists.txt:141 (target_link_libraries): Attempt to add link library "/opt/ros/indigo/lib/" to target "module-name" which is not built in this directory.

I really appreciate if you give me a solution !

Versions Info: Ros Indigo & Ubuntu 14.04

Thank you in advance.

edit retag flag offensive close merge delete


Wasn't this question already answered?

gvdhoorn gravatar image gvdhoorn  ( 2016-09-18 02:53:38 -0500 )edit

Yes, Lucas's answer already solved my problem. I just forgot to close the question, it's my shame. Sorry, and thank you.

Nanoha gravatar image Nanoha  ( 2016-09-18 19:44:57 -0500 )edit

No problem :) I thought I'd already seen this question answered some time ago (sort of like a deja-vu). I didn't mean to imply that you hadn't properly accepted the answer.

gvdhoorn gravatar image gvdhoorn  ( 2016-09-19 01:55:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-17 17:51:16 -0500

lucasw gravatar image

Change the name in your my_package CMakeLists.txt add_executable() or add_library() and target_link_libraries() to something different than what is in original_package.

edit flag offensive delete link more


Thank you for answer, it might be too late to make a reply, but you answer soleved my problem. Thank you.

Nanoha gravatar image Nanoha  ( 2016-09-18 19:47:01 -0500 )edit

Question Tools

1 follower


Asked: 2016-09-03 21:09:01 -0500

Seen: 973 times

Last updated: Sep 17 '16