Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using buildx to build an ARM-based Ubuntu image, running it on an x86 environment with QEMU, and then entering the container to compile C++ code results in a speed that is 8 times slower than the normal x86-based image." #2810

Open
1 of 3 tasks
CTGUMARK opened this issue Nov 22, 2024 · 1 comment

Comments

@CTGUMARK
Copy link

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Dockfile:

基于 ARM 架构 ROS 基础镜像
FROM --platform=linux/arm64 arm64v8/ros:humble-ros-base-jammy

添加镜像信息
LABEL author="Wuxi"
LABEL release-date="2024-11-19"
LABEL base-docker="arm64v8/ros:humble-ros-base-jammy"

安装必要软件和依赖
RUN apt-get update && apt-get install -y curl gnupg2 &&
curl -s https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc | sudo apt-key add - &&
echo "deb [arch=$(dpkg --print-architecture)] https://repo.huaweicloud.com/ros2/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null &&
apt-get install -y vim iputils-ping net-tools ros-humble-rmw-cyclonedds-cpp &&
echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> /root/.bashrc &&
echo 'source /opt/ros/humble/setup.bash' >> /root/.bashrc

docker buildx build --platform linux/arm64 -t arm64v8/ros:humble-ros-development .

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

docker run -it --platform linux/arm64 --network=host --restart=always --name cross_compiling_ws --privileged
-v /home/wu/cross_compiling_ws:/home/wu/cross_compiling_ws
amd64/humble_develop:v0.0 /bin/bash

Expected behaviour

Compile speed improvement

Actual behaviour

Compilation based on qeum took 8 hours Compilation based on x86 took 1 hour

Buildx version

github.com/docker/buildx v0.11.2 9872040

Docker info


Builders list

NAME/NODE DRIVER/ENDPOINT STATUS  BUILDKIT             PLATFORMS
default * docker                                       
  default default         running v0.11.7+d3e6c1360f6e linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

Configuration

Dockfile:
FROM --platform=linux/arm64 arm64v8/ros:humble-ros-base-jammy
LABEL author="Wuxi"
LABEL release-date="2024-11-19"
LABEL base-docker="arm64v8/ros:humble-ros-base-jammy"

RUN apt-get update && apt-get install -y curl gnupg2 &&
curl -s https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc | sudo apt-key add - &&
echo "deb [arch=$(dpkg --print-architecture)] https://repo.huaweicloud.com/ros2/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null &&
apt-get install -y vim iputils-ping net-tools ros-humble-rmw-cyclonedds-cpp &&
echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> /root/.bashrc &&
echo 'source /opt/ros/humble/setup.bash' >> /root/.bashrc

Build logs


Additional info

No response

@tonistiigi
Copy link
Member

QEMU emulator has a performance penalty, especially on CPU intensive tasks like running compilers.

Not sure if there is anything else in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants