ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

ROS2 on Gentoo

Hey, all!

I’m documenting what I did to get ROS2 to cooperate on Gentoo. As problems come up/fixes are created/I learn more, I’ll update!

This was actually not that difficult (though I imagine that, as ROS2 gets bigger, so will the amount of effort). I was able to follow the normal source install, for the most part.

I could not, however, get the vcs to work. Instead, I simply wrote a script to do it.


repositories=$(cat ../ros2.repos | grep url | awk '{print $2}' | grep https)

for url in $repositories; do
	git clone $url

The build then failed, as the branch I checked out was not the correct one. So I cd’d into the src directory, and rand the following:

for i in $(ls); do
cd $i
git checkout -b release-beta1 release-beta1
git reset --hard
cd ../


Then was able to just follow the normal instructions (There was a patch that has been merged already into master).

Then you can just run ament like it states in the tutorial. I had to comment out the tutorial repo in the script, but this is clearly not that essential.

If you have any questions, feel free to post back!

1 Like

Great! Glad it was pretty straight forward!

Out of curiosity, what ros2.repos file are you using ? The tutorials repository is commented on the ros2.repos files since release-beta1[1]. I would have expected this repository not to show up in the resulting repositories variable.


I believe I was using that one, right down to the commented out bit.

Cool thanks for the update. Then I think that your script should work out-of-the-box without having to comment out any repo.

Thanks for investigating that. If you have any idea of why vcstool could not be ran on Gentoo, please post here I’d be curious to know more about why.

I believe we can run it, I just could not find the right one and didn’t want to guess…

@tfoote do you know which one to pip install?

We usually use the python3 version of vcstool for our development. So if you something like python3 -m pip install vcstool should get you the right one. I’m currently using version 0.1.23-1


With the release of ROS 2 Beta 2, I figured it’d be wise to update this!

First, you need to have GCC 5.x installed, as there are some C++14 features that GCC 4 lacks that are used in some places.

Additionally, you need to invoke the build system slightly differently.

PYTHONPATH="/opt/ros/lunar/lib64/python3.5/site-packages:/home/${USER}/ros2_ws/install/lib/python3.5/site-packages:${PYTHON_PATH}" src/ament/ament_tools/scripts/ build --symlink-install --cmake-args -DPYTHON_INSTALL_DIR=install/lib/python3.5/site-packages

After that, everything should build just fine (you might need to change the python 3 version in the above line, depending on what python you have installed, and you might also need to change the rosdistro you have if you want the ros1 bridge).