The process of compiling OpenWrt is always filled with blood and tears.
OpenWrt is fragmented in terms of versions, and my compilation environment is even more fragmented. I have x86 software routers in my VMware virtual machine, and I have virtual machines and Ubuntu 2202-wsl2 for mt798x hardware routers.
Because my Mac is case-insensitive, I have never compiled on a Mac before. Today, I suddenly had the idea to experience how fast it is.
I really like OrbStack, not only Docker, but also the configuration of virtual machines that really impresses me. It can generate a complete Linux environment for arm64/amd64 with just one click, and it automatically mounts rosette under amd64 (a wave of hard advertising).
Create a new Ubuntu 2002 arm machine. Install dependencies.
sudo apt update -y
sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang clangd cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext \
git gperf haveged help2man intltool libelf-dev libglib2.0-dev \
libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 libncursesw5-dev libreadline-dev \
libssl-dev libtool lld lldb lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 \
python3 python3-pip python3-ply python-docutils qemu-utils re2c rsync scons squashfs-tools subversion swig \
texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
sudo apt install gcc-multilib-i686-linux-gnu gcc-multilib-s390x-linux-gnu gcc-multilib-x86-64-linux-gnu gcc-multilib-x86-64-linux-gnux32
sudo apt install g++-multilib-i686-linux-gnu g++-multilib-s390x-linux-gnu g++-multilib-x86-64-linux-gnu g++-multilib-x86-64-linux-gnux32
sudo apt install libc6-dev-i386-amd64-cross libc6-dev-i386-cross libc6-dev-i386-x32-cross
Refer to the following text, the gcc/g++ components for cross-compilation under arm have special suffixes. Here, I can't help but admire how good Go is. Young people don't know how good Golang is and don't treat cross-compilation as a treasure.
Mac is not using MagSafe power, connected to the monitor via Type-C, and with 10 threads for compilation, it runs at a slow output power of about 600,000.
With the default configuration of mt798x 2102 and the addition of ttyd, it takes only about 14 minutes for a full compilation.
As someone who has never eaten fine bran, I'm quite fast. Here, I can't help but envy those big shots who have more than a dozen powerful servers in their living rooms. They can compile everything in the time it takes for a plane to take off.