经gzlug robin li的建议，此文提到这是一个已知问题，可以暂时避免。
QEMU user mode
QEMU is a powerful, open source machine emulator. In “user mode”, it allows a single running Linux kernel to run binaries built for other architectures, without needing a full virtual machine. The binaries can be executed transparently using the kernel’s
feature. Following our instructions
, the whole BuildStream build process can run on an x86_64 machine and produce working RISC-V binaries and images.
While running our first builds with this method, we encountered a bug that caused some programs to hang. We first noticed the issue in
, the build tool for Rust. The hang can be triggered when a program uses
and threads, and when we investigated we saw it was inside GLib, a dependency used in a lot of Linux desktop software. This library is used by QEMU itself, but it might also be used in the process being emulated. When a
call happens, GLib’s memory allocator hits a situation that it isn’t designed to handle, and its thread synchronization locks up completely.
We discussed this upstream in a GLib issue and a QEMU issue, and we hope that QEMU can eventually work around the problem.
In the meantime, you can work around it manually by telling GLib to use
instead of its own allocator –
isn’t necessarily safe to use in a forked process either, but the GNU C Library guarantees that it is. To enable this workaround you set a special environment variable: