Using Docker to build a Linux ARM64 architecture compilation environment

【Foreword】

I didn’t want to bother with the cross-compilation environment, but I really couldn’t bear the slow speed of compiling projects on the A53, so I thought about setting up an arm linux development environment through Docker, so that the compiled projects could be directly copied into the A53 and run. . I just did what I said I would do, I stepped on some pitfalls, but I succeeded in the end. Here is a brief record. Whether you can understand it or not depends on your own destiny.

 

【Dry goods】

1. Create a new admin user (because the arm system user is admin):

sudo su
adduser admin

(全程点默认)

2. Switch to this user

su admin

3. Delete the admin user

deluser admin

4. Install some necessary environments:

sudo apt install qemu-user qemu-user-static gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu  build-essential

5. Build a ros environment in docker

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

sudo docker run -it --name ros-arm --user=$(id -u $USER):$(id -g $USER) --env="DISPLAY" --net=host --workdir="/home/$USER" --volume="/home/$USER:/home/$USER" --volume="/etc/group:/etc/group:ro" --volume="/etc/passwd:/etc/passwd:ro" --volume="/etc/shadow:/etc/shadow:ro" --volume="/etc/sudoers.d:/etc/sudoers.d:ro" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" arm64v8/ros:kinetic

sudo docker exec -u 0 -it ros-arm sed -i 's/ports.ubuntu.com/mirrors.bfsu.edu.cn/g' /etc/apt/sources.list

sudo docker exec -u 0 -it ros-arm apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

sudo docker exec -u 0 -it ros-arm apt update

sudo docker exec -u 0 -it ros-arm apt install ros-kinetic-cv-bridge

sudo docker exec -u 0 -it ros-arm apt install ros-kinetic-move-base-msgs

sudo docker exec -u 0 -it ros-arm apt install libzmq3-dev

sudo docker exec -u 0 -it ros-arm apt install ros-kinetic-tf

6. Enter the container and start your performance

sudo docker start ros-arm
sudo docker exec -it ros-arm bash

7. Tips

When developing code, you can directly copy the code to the admin user. I don’t need to teach you how to switch users on the PC.

【Postscript】

give a like! ! ! Don't get lost!

Guess you like

Origin blog.csdn.net/weixin_39538031/article/details/131007362