jeguzzi / robomaster_ros

ROS2 for DJI Robomaster EP and S1
https://jeguzzi.github.io/robomaster_ros
MIT License
49 stars 10 forks source link

Can't compose Dockerfile during 'colcon build' #9

Open zhuhaier1992 opened 7 months ago

zhuhaier1992 commented 7 months ago

The error msg are as follows:

Step 12/12 : RUN mkdir -p /ros_ws/src     && cd /ros_ws     && git clone https://github.com/jeguzzi/robomaster_ros.git src/robomaster_ros     && source /ros_entrypoint.sh     && colcon build --install-base /opt/ros/humble --merge-install     && rm -r /ros_ws
 ---> Running in 5d2abbf093c0
Cloning into 'src/robomaster_ros'...
Starting >>> robomaster_msgs
Starting >>> robomaster_description
Finished <<< robomaster_description [0.62s]
--- stderr: robomaster_msgs
CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
  execute_process(/usr/bin/python3.10 -m rosidl_adapter --package-name
  robomaster_msgs --arguments-file
  /ros_ws/build/robomaster_msgs/rosidl_adapter__arguments__robomaster_msgs.json
  --output-dir /ros_ws/build/robomaster_msgs/rosidl_adapter/robomaster_msgs
  --output-file
  /ros_ws/build/robomaster_msgs/rosidl_adapter/robomaster_msgs.idls) returned
  error code 1:

  /usr/bin/python3.10: No module named rosidl_adapter

Call Stack (most recent call first):
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
  CMakeLists.txt:39 (rosidl_generate_interfaces)

---
Failed   <<< robomaster_msgs [0.69s, exited with code 1]

Summary: 1 package finished [1.12s]
  1 package failed: robomaster_msgs
  1 package had stderr output: robomaster_msgs
  1 package not processed
ERROR: Service 'driver' failed to build: The command '/bin/bash -c mkdir -p /ros_ws/src     && cd /ros_ws     && git clone https://github.com/jeguzzi/robomaster_ros.git src/robomaster_ros     && source /ros_entrypoint.sh     && colcon build --install-base /opt/ros/humble --merge-install     && rm -r /ros_ws' returned a non-zero code: 1

It seems that /usr/bin/python3.10 can't find a module called rosidl_adapter. So I have tried add a command in Dockerfile that install rosidl_adapter by RUN apt-get install ros-humble-rosidl-adapter. Then it says it's already installed, and shows this same error msg again.

jeguzzi commented 7 months ago

I updated the humble and iron docker files. Try to pull and then build the image.

zhuhaier1992 commented 7 months ago

Hi Jeguzzi, thank you for your prompt reply! Yet I met another problem when I run sudo docker compose up, it reports:

[+] Running 2/0
 Container ep-teleop-1  Created                                      0.0s

 Container ep-driver-1  Created                                      0.0s

Attaching to ep-driver-1, ep-teleop-1
ep-teleop-1  | exec /ros_entrypoint.sh: exec format error
ep-driver-1  | exec /ros_entrypoint.sh: exec format error
ep-teleop-1 exited with code 1
ep-driver-1 exited with code 1

If I run sudo docker build --platform linux/amd/v3 ., it reports:

 [+] Building 0.1s (2/2) FINISHED                             docker:default
 => [internal] load .dockerignore                                      0.0s
 => => transferring context: 2B                                        0.0s
 => [internal] load build definition from Dockerfile                   0.0s
 => => transferring dockerfile: 2B                                     0.0s
ERROR: failed to solve: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount3063548553/Dockerfile: no such file or directory

And if I run: sudo docker run -it f38430005841 # id of jeguzzi/robomaster_ros, then it reports:

The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested
exec /ros entrypoint.sh: exec format error

I don't know if it's because I am running ubuntu20 on vmware. I will try to do it on physical machine tomorrow.

jeguzzi commented 2 months ago

Hi @zhuhaier1992 ,

in case you still have the problem, I image that it is caused by pulling the docker image from my docker hub repo, and getting the wrong architecture. Try to build the image locally. I don't know why the build failed but most probably it does not have a direct link to the robomaster_ros image.