Rosanswers logo


Even with a source based install of ROS2, running rosdep will install libraries into /opt/ros/galactic/. To have all packages available in every terminal I open, do I have to source both ros2_galactic/install/setup.bash and /opt/ros/galactic/setup.bash?. If so, in which order?


I installed ros2_galactic from source following the instructions in the galactic tutorial. I was next trying to install Moveit, and was coming across a CMake error indicating that the eigen_stl_containers library was missing.

Could not find a package configuration file provided by
  "eigen_stl_containers" with any of the following names:


Although the rosdep command in the previous step should have downloaded eigen_stl_containers, I ran sudo apt install ros-galactic-eigen-stl-containers, but the output stated that I had the library already installed.

ros-galactic-eigen-stl-containers is already the newest version (1.0.0-3focal.20210507.020504).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

It turned out that the problem was I was only running source ~/ros2_galactic/install/setup.bash, but the eigen_stl_containers was installed through binaries so I had to also run source /opt/ros/galactic/setup.bash.

To have all packages available in every terminal I open, do I have to add both of those commands to ~/.bashrc, and if so, in which order?

Originally posted by ijnek on ROS Answers with karma: 460 on 2021-08-01

Post score: 0


1 Answer 1


Rosanswers logo

Any packages you want to use will need to exist on paths on the various ROS environment variables (e.g. PATH, AMENT_PREFIX_PATH, etc). The order in which you source these should be determined by what you want to have priority.

Environment variable additions are prepended so if you had both source and binary installations of a given package, priority would be given to the one you sourced the most recently. In your case, you probably want to prioritize the source installation, so you would probably want to:

source /opt/ros/galactic/setup.bash
source ~/ros2_galactic/install/setup.bash

You can add these two lines to the end of your .bashrc if you don't want to manually source both paths every time you open a new terminal.

Originally posted by shonigmann with karma: 1567 on 2021-08-02

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.