CAUTION

We (distro packagers) decided to modify GCC spec to get rid of just way too many atomic symbol missing error. AFAIK debian does the same thing in the same way.

So, you may notice that some program compiles without -latomic flag, but that's not the case if you switch to some other distros. I wrote another blog post explaining this in detail.

In short: For GCC you should add -latomic if you use std::atomic<T> where sizeof(T) is lower than 4. Also apply to those __atomic_compare_exchange_2() stuff. Clang is not affected.

Method

This approach requires you to be on an non-RISC-V Arch Linux (x86_64 or aarch64, etc.) machine, because we use pacstrap and pacman.

If, in the last step, you find yourself stucked at [ OK ] Reached target Graphical Interface for too long, just press Ctrl-C and re-run startqemu.sh.

After booting the machine, you may need to install necessary packages:

Detailed Explanation (zh)

mkrootfs

https://riscv.mirror.pkgbuild.com 为 Arch Linux 维护者在 pkgbuild.com 域名上为 Arch Linux RISC-V 创建的全球镜像。如果不添加这个镜像，初始的默认源从国内访问可能较慢或干脆无法访问。

TBD