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

How can I build a specific ROS2 package only?

asked 2018-03-08 12:57:54 -0600

thinwybk gravatar image

I have pulled all ROS2 repos into my overlay workspace using

wget https://raw.githubusercontent.com/ros2/ros2/release-latest/ros2.repos
vcs import src < ros2.repos

How can I build one specific package and its dependencies only? Let's say I want to build rcl with ament build --only-packages rcl this will not work because of the directory structure in src where rcl resides in src/ros2/rcl.

edit retag flag offensive close merge delete

Comments

The location of rcl in the src folder doesn't matter when using --only, because it matches package names, not folder locations.

William gravatar image William  ( 2018-03-08 13:20:57 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2018-03-08 13:22:16 -0600

William gravatar image

I'd also add to @tfoote's answer:

How can I build one specific package and its dependencies only?

You cannot currently do that, --end-with rcl will build all packages that would have been built before rcl whether or not rcl depends on them.

edit flag offensive delete link more

Comments

Means its not possible to combine --start-with with --end-with then?

thinwybk gravatar image thinwybk  ( 2018-03-08 13:28:35 -0600 )edit
0

answered 2022-10-24 17:59:05 -0600

bradsteiner gravatar image

Try using colcon build --packages-select <name-of-pkg>

edit flag offensive delete link more
0

answered 2018-03-08 13:04:20 -0600

tfoote gravatar image

You can use the --end-with option to build to stop the build after a certain package. (aka your target package like rcl)

For more options try ament.py build -h to see usage.

edit flag offensive delete link more

Comments

My problem is that ament doesn't find the package: ament build: error: argument basepath: Path 'rcl' does not exist

thinwybk gravatar image thinwybk  ( 2018-03-08 13:10:59 -0600 )edit

It is not clear to me how to set the basepath appropriately. If I run e.g. ament build --only-packages=rcl src/ros2/ I get CMake Error: The source directory "/home/florian/ws_github/ros2-devenv/ros2_overlay_ws/src/rcl/rcl" does not exist.

thinwybk gravatar image thinwybk  ( 2018-03-08 13:18:18 -0600 )edit

Based on that error I'd say your arguments are wrong, it thinks the argument rcl is the location of the workspace.

William gravatar image William  ( 2018-03-08 13:19:40 -0600 )edit

That's a different question. Please ask a separate question and provide more information about how to setup your environment and the full commands you're running not just the output. Your error and your command example don't match.

tfoote gravatar image tfoote  ( 2018-03-08 13:21:42 -0600 )edit

Alright...

thinwybk gravatar image thinwybk  ( 2018-03-08 13:24:01 -0600 )edit

Your original command ament build --only rcl should just work, assuming you're in the root of the workspace (directory which contains the src and install folders).

William gravatar image William  ( 2018-03-08 13:27:21 -0600 )edit

If I run ament build --only rcl I get CMake Error: The source directory "/home/florian/ws_github/ros2-devenv/ros2_overlay_ws/src/rcl/rcl" does not exist.. I use a dockerized ROS2 environment (which is not really "stable" for public right now) with the overlay setup from...

thinwybk gravatar image thinwybk  ( 2018-03-08 13:31:05 -0600 )edit

... ros2.org ament tutorial (create an overlay) but instead of pulling examples package I pull with wget https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos and vcs import ~/ros2_ws/src < ros2.repos.

thinwybk gravatar image thinwybk  ( 2018-03-08 13:31:41 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-03-08 12:57:54 -0600

Seen: 5,970 times

Last updated: Oct 24 '22