You are here:Home»KB»PC»Virtual Machines»My AQEMU Notes
Monday, 25 April 2022 14:15

My AQEMU Notes

Written by

Build Instructions for GitHub - chronic8000/aqemu: AQEMU - Qt frontend for QEMU. Maintained by Chronic Engineering (Windows & Linux). GPLv2. · GitHub

This assumes you are using vscode and I will be using my default locations

Also we will not be bundling QEMU, I will use https://qemu.weilnetz.de/w64/ 

Setup Dependencies

  • Git for Windows
  • MSYS2
    • Install to:
      D:\libs\msys64
    • After installing, open MSYS2 UCRT64 from the Start menu. In the terminal run
      pacman -Syu
      • this updates stuff
      • select yes when prompted
      • the terminal will probably close when finished
      • Reopen MSYS2 UCRT64, and re-run the command again to do further updates
    • Then install the build tools:
      pacman -S --needed mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-pkgconf mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-spice-gtk mingw-w64-ucrt-x86_64-gobject-introspection mingw-w64-ucrt-x86_64-libvncserver mingw-w64-ucrt-x86_64-qt5-base
      • select yes when prompted
      • we can now close this terminal
    • Make the MSYS2 UCRT64 tools available to VS Code (including gcc, pkgconf, ninja, spice) I have added it temp in the build script for now
      • If you only want it for the current PowerShell window, this is much easier:
        $env:Path += ";D:\libs\msys64\ucrt64\bin"
      • If you want it permanently, Windows has a built-in command:
        setx PATH "$($env:PATH);D:\libs\msys64\ucrt64\bin"
    • Notes
  • Qt for MiniGW
    • Qt says: We recommend you use the Qt Online Installer for first time installations and the Qt Maintenance Tool for changes to a current install.
    • Download
    • Install
      • Create an account if needed
      • Login with your account
      • Install to:
        D:\libs\Qt
      • Don't install the MSVC version of Qt.
      • Deselect `Qt 6.11 for desktop development`
      • Select Custom Installation and pick
        • Show archive versions using the toggle at the top right 
        • Select only
          • Qt for Development --> Qt --> Qt 5.15.2 --> MinGW 13.1.0 64-bit
      • Select `Qt 6.11 for desktop development`
        • This is installing (maybe to its own system use)
          • MinGW
          • CMake
          • Ninja
          • Qt
      • Don’t associate common file types with Qt Creator
      • NB: I am not sure if I need all of the programs
  • Cmake
    • Install
      • Use the Windows installer.
      • Add CMake to the system PATH (the installer does this for you, but you need to reboot)
    • Notes
      • I used cmake for for making notepad++ plugin
        C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin
  •  WinLibs - GCC+MinGW-w64 compiler for Windows
    • WinLibs standalone build of GCC and MinGW-w64 for Windows
    • What is it? In short: it's a free C and C++ compiler for Microsoft Windows.
    • I don't think I have needed it yet with this project.

 

Setup VSCode Project

  • Create a project folder
    D:\websites\htdocs\projects\standalone\aqemu
  • Open the project folder in VSCode
  • Clone the aqemu GitHub Repository
    git clone --recursive https://github.com/chronic8000/aqemu.git .
    • The --recursive is important because the repository has submodules, including the optional QEMU source tree.
    • If you are not bundling QEMU the submodules might not be needed
  • Add a `localonly` folder
    • create the folder and add an exception in htaccss
    • Put all the downloaded assets in here
  • Create a build folder
    D:\websites\htdocs\projects\standalone\aqemu\build_win

Build Instructions

We are still in VScode in the aqemu workspace

  • This builds: WinLibs UCRT MinGW + Qt 5.15; SPICE from MSYS2 ucrt64 via PKG_CONFIG_PATH only. 
  • $env:Path += ";D:\libs\msys64\ucrt64\bin" is added because I have not added MSYS2 to my windows PATH.
  • cmake needs to use forward slashes (/)
    • CMP0207 — CMake 4.4.3 Documentation
      • CMake 4.3 and above prefer to normalize paths to use forward slashes before matching.
      • This policy provides compaitiblity for projects that may have been relying on matching backslashes only.
  • Run this powershell script
    $env:Path += ";D:\libs\msys64\ucrt64\bin"
    $env:PKG_CONFIG_PATH = "D:\libs\msys64\ucrt64\lib\pkgconfig"
    mkdir build_win -Force; cd build_win
    cmake -G Ninja `
      -DCMAKE_PREFIX_PATH="D:/libs/Qt/5.15.2/mingw81_64" `
      -DAQEMU_WITH_SPICE_GTK=ON `
      ..
    ninja
    .\aqemu.exe
    • Add the ucrt64\bin folder temporarily to the environmental PATH variable This is an issue becasue of its placement in the path chain)
    • Adds to PKG_CONFIG_PATH to the environmental variables. It is not persistent
    • makes a folder called build_win and then moves to it
    • cmake is essentially the project's own Windows build command.
    • ninja compiles the binary

First script that works from claude

$ErrorActionPreference = 'Stop'
$repo = 'D:\websites\htdocs\projects\standalone\aqemu'

# ucrt64 first on PATH so its gcc/ninja/pkg-config win over anything else installed
$env:Path = "D:\libs\msys64\ucrt64\bin;$env:Path"
$env:PKG_CONFIG_PATH = "D:\libs\msys64\ucrt64\lib\pkgconfig"

cmake -G Ninja `
  -DCMAKE_PREFIX_PATH="D:/libs/msys64/ucrt64" `
  -DAQEMU_WITH_SPICE_GTK=ON `
  -S $repo -B "$repo\build_win"
if ($LASTEXITCODE -ne 0) { throw "cmake configure failed" }

ninja -C "$repo\build_win"
if ($LASTEXITCODE -ne 0) { throw "ninja build failed" }

& "$repo\build_win\aqemu.exe"
  • -DCMAKE_PREFIX_PATH="D:/libs/Qt/5.15.2/mingw81_64" ` also works.

PowerShell Build Scripts (from claude)

  • Why do i have build.ps1 and package_win.ps1? do they do the same thing, is there functionality cross over?
    • They're two stages of one pipeline, not duplicates:
      • build.ps1 — configures CMake and runs ninja to compile aqemu.exe into build_win\. At the end it calls package_win.ps1 for you (build.ps1:48).
      • package_win.ps1 — takes the already-built build_win\aqemu.exe and turns it into a portable folder: copies the binary, pulls in Qt plugins, walks the DLL import tree recursively to bundle every dependency, verifies nothing's unresolved, and optionally zips it up.
    • So there's no real overlap in what they do — build.ps1 handles compiling, package_win.ps1 handles packaging — they're just chained together so .\build.ps1 alone gets you from source to a distributable dist\aqemu\ folder. The reason package_win.ps1 exists standalone is so you can re-package without a full rebuild (e.g. after just touching Qt plugins or DLL logic), via .\package_win.ps1 -Zip.
    • So You don't actually have to run both manually — build.ps1 already calls package_win.ps1 for you at the end, passing along your -Zip switch:
    • You'd only run package_win.ps1 by itself if you wanted to re-package without rebuilding (e.g. you didn't touch source code but want to re-verify DLLs or just re-zip).
  • Here's what .\build.ps1 -Zip actually does:
    • Runs cmake configure and ninja -C build_win — this is an incremental build. If build_win\ already exists with prior build artifacts, ninja only rebuilds what changed (like any normal build). It does NOT wipe/rebuild everything from scratch.
    • Calls package_win.ps1 -Zip, which packages whatever build_win\aqemu.exe currently is into dist\aqemu\, then zips that folder to dist\aqemu-win64.zip.
  • What should I run?
    .\build.ps1 -Zip
    • This will recompile and build the /dist/aqemu-win64.zip
  • To force a true from-scratch build, you need -Clean too:
    .\build.ps1 -Clean -Zip
    • This wipes build_win\ first (build.ps1:40), then reconfigures, rebuilds everything, and zips the result.

Notes

  • This directory is hardcoded in CMakeLists.txt twice for spice
    C:/msys64/ucrt64/bin
  • This directory is hardcoded in scripts/build_img4_windows.ps1
    C:\msys64\ucrt64\bin

Troubleshooting

 

 

 

 

Read 25 times Last modified on Wednesday, 16 September 2026 16:10