# Using zig build's QEMU integration?

**URL:** <https://ziggit.dev/t/using-zig-builds-qemu-integration/7234>\
**Category:** Help\
**Tags:** build-system\
**Created:** [December 9, 2024, 8:41am UTC](https://ziggit.dev/t/using-zig-builds-qemu-integration/7234 "2024-12-09T08:41:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsdtas](https://ziggit.dev/user_avatar/ziggit.dev/tsdtas/32/3512_2.png) [@tsdtas](https://ziggit.dev/u/tsdtas)\
**Post date:** [December 9, 2024, 8:41am UTC](https://ziggit.dev/t/using-zig-builds-qemu-integration/7234/1 "2024-12-09T08:41:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dimdin](https://ziggit.dev/user_avatar/ziggit.dev/dimdin/32/1457_2.png) [@dimdin](https://ziggit.dev/u/dimdin)\
**Post date:** [December 9, 2024, 9:01am UTC](https://ziggit.dev/t/using-zig-builds-qemu-integration/7234/2 "2024-12-09T09:01:24Z")

</div>

> [@tsdtas](#):
>
> 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.

* * *

> [@tsdtas](#):
>
> Is the functionality documented anywhere?

`enable_qemu` in [std.Build](https://ziglang.org/documentation/master/std/#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)
> ```
