First: I’m not entirely sure this belongs here, but I couldn’t think of a better category. It’s probably something that will touch the buildfarm if we can come up with something, hence why I posted it here.
I’ve been interested in reducing the size of deployments of ROS applications, both native and in Docker (and Singularity) images for some time now, and one thing that I have been curious about is whether it would be possible to generate separate runtime and
-dev archives from ROS packages (to use the Debian/Ubuntu terminology).
Some Googling led me to How to separate bloom-generate’d debian package into variants (release, -dev, -dbg)? on ROS Answers, which has an answer by @tfoote mentioning the support for automatic generation of
-dbg symbol packages (which has been active for Melodic and newer releases), but couldn’t find additional discussions about the topic.
Dockerfiles tremendous savings can be accomplished (going from 4GB+ to 200MB images), but this is non-trivial with ROS packages in the mix.
Thinking about it, I can see two aspects which may make this either difficult or reduce the gains significantly:
- ROS has (very) few leaf packages: many ROS packages export libraries, headers and other resources that get consumed by others as part of a build. This means that when a package is installed, it’s most likely installed because it’s being used by another. Main contributor to package size are the libraries (this is an assumption), which would always be present and thus having a separate runtime and
-devpackage doesn’t offer much net gain.
- it’s not necessarily something that can be automated: creating proper Debian packages can be hard. Part of what makes it complex is knowing what should go where, and this is not always obvious either. A single source package could spawn multiple binary packages, and the rules that govern this are typically largely hand written.
Pt 1 may not be too problematic. It’s an assumption and would be something to figure out.
Pt 2 could perhaps be approached very naively: assume everything exported by
INCLUDE_DIRS in a
catkin_package(..) call (in ROS 1) and is local to the exporting package is what should go in a
-dev package. Assume everything else would go into the runtime package. That information would somehow be transferred to Bloom when it populates the package structure and
Another option could be to use CMake’s support for
install(..) rules (as that could make it work for ROS 2 as well), but I have no idea whether that would help when generating Debian/RPM/something-else packages.
I also realise that to do this right is probably going to be complex and will require quite some effort.
This post here on Discourse is to find out whether others have thought about this as well or perhaps even have implemented something in this direction.