The lazy programmer scripts
scripts that work

Overview for gnu

Lazy build qemu-img.exe statically from source

qemu-img is a great tool to convert and create disk images on the fly on Windows or Linux. On Windows, I use it to convert VHD(X) to qcow2 or any disk formats you can imagine.

If you want the qemu binaries prebuilt for Windows, you can easily download them from The installer contains the qemu-img.exe binary too.

The documentation to build it on *nix systems is pretty good, but it is lacking parts of it on how to build it on Windows, especially how to build the static version of it. The official documentation can be found at

Static build means that I only want a qemu-img.exe binary which works without any open source dependency .dll. Just a small binary, preferably as small as possible (less than 5MB), which works on any Windows version > Windows Vista. The only requirement for the box where you run it is the MSVC (Microsoft Visual C++) runtime.

So, let's get the party started! The scripts below should be run in the mingw64 console after you install msys64.

Written by kami on Friday September 27, 2019
Permalink - Tags: windows, qemu, gnu, linux, c, static