ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
7

How to 'catkin_make clean' just one package?

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

Pi Robot gravatar image

Hello,

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.

Thanks!
patrick

edit retag flag offensive close merge delete

Comments

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 imageDirk Thomas ( 2013-07-01 14:22:39 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

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

Dirk Thomas gravatar image

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

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

Comments

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 imagePi Robot ( 2013-07-01 16:06:45 -0500 )edit
1

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

Dirk Thomas gravatar imageDirk Thomas ( 2013-07-01 16:09:31 -0500 )edit
1

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 imagePi Robot ( 2013-07-01 16:12:36 -0500 )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 imageDirk Thomas ( 2013-07-01 16:18:27 -0500 )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 imagePi Robot ( 2013-07-01 16:33:20 -0500 )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 imageWilliam ( 2013-07-01 16:39:04 -0500 )edit

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

Pi Robot gravatar imagePi Robot ( 2013-07-01 16:46:54 -0500 )edit
1

Another option to clean up could be:

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

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

ponsheng gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 35,671 times

Last updated: May 12 '17