Ask Your Question

Problem with Turtlebot3 in Dockerfile: CMake Error at CMakeLists.txt

asked 2022-06-23 04:05:35 -0500

Zeckurbo gravatar image


I have a problem with setting up a Turtlebot3 in a docker container. I start with a installed ROS2 foxy on Ubuntu:focal

My ~/.bashrc inside the container looks like this:

source /opt/ros/foxy/setup.bash
export GAZEBO_MODEL_PATH=:~/turtlebot3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models

What I do in the Dockerfile is:

WORKDIR /root/turtlebot3_ws/src
RUN git clone -b foxy-devel
RUN git clone -b foxy-devel
RUN git clone -b foxy-devel
RUN git clone -b foxy-devel
WORKDIR /root/turtlebot3_ws
RUN cat ~/.bashrc
RUN source ~/.bashrc && colcon build --symlink-install

The last line throws the error:

--- stderr: dynamixel_sdk
CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "ament_cmake", but CMake did not find one.

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


  Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
  "ament_cmake_DIR" to a directory containing one of the above files.  If
  "ament_cmake" provides a separate development package or SDK, be sure it
  has been installed.

Failed   <<< dynamixel_sdk [1.02s, exited with code 1]

But if I run the container (created without the last line) and run colcon build --symlink-install by hand, it installs just fine.

Any ideas what I could do wrong here? As seen, ROS foxy should be sourced right in the .bashrc

Thank you in advance

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-06-27 06:40:09 -0500

Zeckurbo gravatar image

As I found the solution here and here, the fix was to directly source:

RUN source /opt/ros/foxy/setup.bash && colcon build --symlink-install

I dont know why sourcing ~/.bashrc did not work, but now it seems to build in the docker creation just fine.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-06-23 03:54:59 -0500

Seen: 25 times

Last updated: Jun 27