# How to catkin_make one package

I'm trying to install my custom ROS workspace from source.

What I've done is to download the source code of version of ros-kinetic-ros-base, then I add some additional packages into ros-base.

When I add one package, I always execute ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release to catkin_make all packages. This gonna take much time.

So I'm thinking if I can catkin_make only one package that I added because others have been installed before.

For example, here is the structure of my ros-base:

/home/ros/ |-----------src |-----------build_isolated |-----------devel_isolated |-----------install_isolated

As you see, all have been done correctly after executing ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release. Now I add a package named newPkg into ./src. To rebuild, I have to execute the command again, which will rebuild all packages.

So is it possible to catkin_make the only one package?

edit retag close merge delete

Sort by » oldest newest most voted

Check #q54178.

Personnally I use catkin_make -DCATKIN_WHITELIST_PACKAGES="foo;bar".

more

This worked to me:

catkin_make_isolated --install --pkg YourPackageName

more

I would recommend moving to use catkin build instead of catkin_make. catkin build has a lot more functionalities, and as mentioned in the migrating from catkin_make doc

Unlike catkin_make, the catkin command-line tool is not just a thin wrapper around a the cmake and make commands. The catkin build command builds each package in a workspace’s source space in isolation in order to prevent build-time cross-talk. As such, in its simplest use, catkin build behaves similarly to a parallelized version of catkin_make_isolated.

Note that a workspace cant use both catkin_make and catkin build simultaneously, only 1 of them at any one time. Then, in order to build a single package, you can use catkin build PKG_NAME.

more

The whitelist mentioned by @Delb will work. But catkin_make_isolated directly supports this use-case with command line arguments:

[...]
--pkg PKGNAME [PKGNAME ...]
Process only specific packages (only after
catkin_make_isolated has been invoked before with the
same install flag)
--from-pkg PKGNAME    Restart catkin_make_isolated at the given package
continuing from there (do not change CMake arguments,
add/move/remove packages or toggle the install flag
when using this option since this may result in an
inconsistent workspace state).
--only-pkg-with-deps ONLY_PKG_WITH_DEPS [ONLY_PKG_WITH_DEPS ...]
Only consider the specific packages and their
recursive dependencies and ignore all other packages
in the workspace (only works together with --merge or
--install)
[...]


So to build only your newPkg, I would use:

catkin_make_isolated --only-pkg-with-deps newPkg


Note: your question title asks about catkin_make, but your question is really about catkin_make_isolated. They're both binaries having to do something with Catkin, but they're not identical and their behaviour can and does vary.

"catkin_making" is not a thing. catkin_make is a wrapper around CMake, just as catkin_make_isolated is. Even though you invoke it using catkin_make, in the end it just runs make (or ninja, depending on the generator you've chosen).

Edit: I just noticed that you're managing a 'base' source build. If you're trying to do 'normal' development after having built your base ROS, I would recommend to use an overlay workspace to store your own packages in. That way only the pkgs in that workspace will be built, removing the need to explicitly limit the packages.

more