Building ROS2 from source locally (without root)
Is it possible to build ros2 from source without sudo?
One of the first steps is
sudo rosdep init
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Is it possible to build ros2 from source without sudo?
One of the first steps is
sudo rosdep init
Asked: 2022-05-24 01:32:39 -0600
Seen: 249 times
Last updated: May 24 '22
robotino_drivers building errors
Received 'rospack failed to build' message when executed rosmake
Dependencies and rosmake in Fuerte and following distributions
I had a compilation error when i build rosjava_core source package
how to make debian packages for ros fuerte or groovy
Building rviz_plugins_tutorials on OSX [closed]
Building Angstrom following wiki: where is the image...
How to setup Pioneer 3-dx for building a map
For this specifically, see #q317938 and #q263604.
It's not impossible, but without being able to install dependencies, it's going to be a very manual process.
I'd recommend looking into containers, such as Docker, Singularity/Apptainer, LXC, etc.
Other systems like YOCTO, manage to build without sudo, after a handful of basic system dependencies are installed. At some point in the build process yocto also just fetches dependencies but installs them locally into build folders without root access. Its not clear why just building the ROS middle-ware requires root.
Because Yocto builds root FS completely from source, and has the infrastructure to do that, including recursive dependency resolution, fetch and build. The default installation procedure for ROS 2 is to use pre-built binary packages for your OS -- if those are available.
From-source builds should only be used if they are required.
Could you perhaps clarify what your use-case is?
meta-ros for instance can be used to build root FS using Yocto, but it's certainly not the first point-of-entry for (new) ROS 2 users.
From your terse description it's not clear (to me at least) what you're trying to do: build ROS 2 from source in a general 'user' context, or build it for deployment in a more embedded/commercial environment.
Those two are rather different.
Thanks for the response gvdhoorn.
My deploy target will be a custom embedded device, for which I have the yocto-sdk (which is really just a toolchain and a basic root FS for the target). On my desktop, I figured I'd do a source build to figure out the build process, and the dependencies. Given this I'm not sure I can avoid doing source builds.
Having step one of the build process install a bunch of unknown stuff into root feels wrong. Can this step be skipped if I install the same tools locally? Thou I'm not sure how I would figure out what these might be.
Since ROS install things into my system how do I run different versions of ROS?
This feels a bit like an xy-problem.
It seems you're already using Yocto, so would it not be an idea to investigate
meta-ros
before doing anything else?There is a process for building from-source on desktop OS, but it'll be radically different from how
meta-ros
approaches this.I'm not sure what you'd gain by going the build-on-desktop route first.
The base embedded system is provided by a vendor, so I only have an SDK at the moment.
My hope is I can build ROS's libs and apps and dependencies without root access, and with minimal coupling to the host OS. If ROS needs a specific 3rd party library than it should build it independently of the host OS's version.
Well, as I wrote, it's all possible, but not a workflow that's been automated or documented.
For automated from-source builds with (almost) no dependencies on the host OS,
meta-ros
is typically used, or superflore (for platforms like Gentoo and Arch).For from-source builds on Debian and derivatives, and RHEL and derivatives, system dependencies are typically resolved using
rosdep
and installed using the platform's package manager.For other systems (and the ones mentioned earlier), a fully contained installation can be achieved using conda/robostack. Technically, you could build all of that yourself as well in a Conda environment.
this sounds like an opinion, not a technical requirement or best-practice.
Perhaps taking a look at how
meta-ros
does this and replicating it could help?If I focus on the desktop/ubuntu install for the moment. I think with one small tweak to rosdep , it might we able to run without root. It just needs the ability to store and read it package list from a user folder not one owned by root in /etc.
It already has the simulation run option, so it can be run without root, but instead outputs the commands that the user is then expected to run with sudo.
This would then be similar to other non-distro installers like "rustup" or "ghcup" which do something similar.