Using zig build's QEMU integration?

I see that zig build -h shows the options -fqemu and -fno-qemu:

Integration with system-installed QEMU to execute
foreign-architecture programs on Linux hosts
(default: no)

The flag will let my tests run when I cross-compile, so it seems to be working. I have questions:

Is the functionality documented anywhere?
Does anyone have any experience using it?
What does it change compared to just building for the emulated platform?

It is using QEMU only when you run cross-compiled build artifacts (tests and executable). You can also use wine to run Windows artifacts and darling to run macOS artifacts.


enable_qemu in std.Build:

Use system QEMU installation to run cross compiled foreign architecture build artifacts.

and in zig build --help:

-fqemu,   -fno-qemu      Integration with system-installed QEMU to execute
                         foreign-architecture programs on Linux hosts
                         (default: no)
1 Like