0
$\begingroup$

Rosanswers logo

If you build ROS2 from source, how do you add other/new packages? Can you apt-install those or do they need to be built from source as well? If you have to build them from source. Do you add them to your personal workspace or the workspace where you build ROS?

I could find nowhere a clear answer on this.

edit: Clarification it's the core ROS2 that's built from source, not just a couple of packages.


Originally posted by Koen on ROS Answers with karma: 1 on 2021-09-06

Post score: 0

$\endgroup$

2 Answers 2

1
$\begingroup$

Rosanswers logo

Can you apt-install those or do they need to be built from source as well? This also applies if the core ROS2 is built from the source? (because reasons), Can you then still install extra packages with apt?

It's still possible, but I doubt it will make sense.

Any leaf package will depend on packages higher up in the dependency tree. Core packages are almost at the root.

If you've built ROS 2 from sources, you'll not have any of those core packages. apt cannot resolve dependencies by looking at your files (ie: your colcon_ws), it only knows what it has installed itself (by default).

Ergo: if you try to install a leaf(ish) package while having none of the core(ish) packages, apt will start installing everything needed to satisfy dependencies of your lead(ish) package.

This is not ROS 2 specific btw: the same situation exists in ROS 1 (and everywhere else you try to mix .debs with from-source builds).

PS: comparing to what @shonigmann wrote: a from-source built ROS 2 base install cannot function as an underlay for further apt installs (well, technically it's possibly by tricking apt, but I doubt you should do this if you're asking these kinds of questions).


Originally posted by gvdhoorn with karma: 86574 on 2021-09-20

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

You are free to use whatever mix of source and debian installs you like, as long as you are meeting dependencies and sourcing the packages as appropriate. The caveat being that apt may try to install the debian versions of dependencies that you've already installed through your source build. To my knowledge, the only consequence is using a bit more disk space. You can "overlay" your source build of ROS2 to give it priority, so that your system knows to use the source version of, say, rclcpp instead of the one that was installed through apt.

In your case, deciding whether to use apt (debian) or source installation, you should ask yourself whether you will want to change the packages. If yes, then go with source so you can rebuild when you add modifications. If no, then install the debians directly - this will be faster and lighter weight.

If you do end up installing from source, it is generally advised to create a new workspace for the packages you want to work with that can "overlay" your core ROS2 installation. That way, your install and build directories are isolated and it is faster to rebuild if you happen to break something. You can have multiple over/underlays too, so it can even be worth having separate workspaces for "large" packages that can take a long time to build (e.g. MoveIt2, Nav2).


Originally posted by shonigmann with karma: 1567 on 2021-09-07

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Koen on 2021-09-20:
Okay, thank you. This also applies if the core ROS2 is built from the source? (because reasons), Can you then still install extra packages with apt?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.