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

How to 'catkin_make clean' just one package?

asked 2013-07-01 14:16:35 -0600

Pi Robot gravatar image

updated 2022-01-22 16:16:27 -0600

Evgeny gravatar image


How can we completely remove a single catkin package from our catkin workspace? The commands:

$ cd ~/catkin_ws
$ catkin_make clean package_name

appears to also remove shared objects from all other packages in the workspace so that a subsequent "catkin_make" has to rebuild stuff in those packages. I would like a way to remove all build objects from a package without affecting other packages and so that subsequently removing the source tree of the package in question would remove all traces of it from the workspace.


edit retag flag offensive close merge delete


Your command invokes catkin_make clean and than catkin_make package_name which cleans everything and than builds only the executable/library package_name.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-07-01 14:22:39 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-07-01 14:25:40 -0600

Dirk Thomas gravatar image

updated 2013-07-01 14:27:11 -0600

catkin does not provide a package-specific clean target. The reason is simply that CMake does not provide the necessary information what targets and generated files belong to a project.

So you have to first remove the package from the workspace (or place a CATKIN_IGNORE file in the repository/package folder). Then depending on how clean you need the workspace to be you could either call make clean followed by a normal make or remove the build and devel folders completely and perform a clean catkin_make.

edit flag offensive delete link more


Thanks Dirk. Unfortunately, running 'make clean' in any directory under ~/catkin_ws (including the root) results in the following error:make: * No rule to make target `clean'. Stop.

Pi Robot gravatar image Pi Robot  ( 2013-07-01 16:06:45 -0600 )edit

Either call catkin_make clean in the root of the workspace or plain make clean in the subfolder build.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-07-01 16:09:31 -0600 )edit

D'oh! I missed trying it in the build directory. OK thanks. But my original problem remains. So there is really no way to completely remove a catkin package without having to rebuild other packages? This seems mildly tedious...

Pi Robot gravatar image Pi Robot  ( 2013-07-01 16:12:36 -0600 )edit

No, there is no alternative. But rebuilding your workspace is only a matter of a couple of seconds. If your are not yet using ccache you should give that a try.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-07-01 16:18:27 -0600 )edit

Thanks for the ccache tip. Unfortunately it doesn't appear to provide any noticeable speedup even though it is now symlinked to cc and gcc. Rebuilding my workspace can take many many minutes if it includes some packages like ecto.

Pi Robot gravatar image Pi Robot  ( 2013-07-01 16:33:20 -0600 )edit

ccache is only faster after the first build. If you use catkin_make_isolated you can remove a package by deleting the build/pkg_name and devel/pkg_name folders. But for catkin_make everything is in a shared build and devel space so you can't do that.

William gravatar image William  ( 2013-07-01 16:39:04 -0600 )edit

Thanks for the pointer to catkin_make_isolated which I did not know about. Looks promising!

Pi Robot gravatar image Pi Robot  ( 2013-07-01 16:46:54 -0600 )edit

Another option to clean up could be:

$ cd ~/catkin_ws
$ rm -r build devel install
angelos.p gravatar image angelos.p  ( 2017-04-11 06:13:22 -0600 )edit

answered 2017-05-12 08:08:26 -0600

ponsheng gravatar image

updated 2017-05-12 08:09:13 -0600

Hello, Now I use the new catkin tools,which provides a clear and convenient interface.

Using one of the tool : catking clean, one can cleaning up a single package by command:

$ catkin clean PKGNAME

It's a great tool for catkin workspace management.

edit flag offensive delete link more

Question Tools



Asked: 2013-07-01 14:16:35 -0600

Seen: 71,253 times

Last updated: May 12 '17