Skip to content

Compiling and Running on Windows

vintagepc edited this page Aug 8, 2022 · 6 revisions

It works!

NOTE: You must have a git checkout of the repository. Zip source downloads do not work as they are missing the submodule information and contents (and I'm not aware of a way to replace the standard github zip links on the repo main page)

** NOTE: The following steps regarding Cygwin apply to v0.9.4 and earlier only. Later commits require MSYS2 as Cygwin does not offer glib-2.56. Instructions for MSYS2 will be authored soon. **

Compiling on Windows is done via Cygwin using the MinGW toolchain to produce a native Windows executable. (Cygwin environment is not required to run it)

  • In theory it is possible to compile using MSYS2 without Cygwin but in practice I did not have any luck and kept encountering errors relating to missing packages or bad development environment.
  • I've also attempted to cross-compile from Ubuntu with MinGW (since the current build takes 30 minutes via Actions) with no success as Ubuntu's PPAs seem to be missing a number of required .dll packages.
  • Cross compiling can be done on OpenSuSE with MinGW but GitHub does not offer this as a build runner platform.

If you've had success with either of these scenarios, please do get in touch by opening an issue or discussion to share your recipe!

Preface: Windows support is beta. This means it appears to be functional but there may still be unexpected bugs in less-traveled pathways, Feel free to open an issue or discussion if you think you've found one!

Cygwin packages required (they will pull in additional dependencies):

  • gcc-core
  • git
  • make
  • mingw64-x86_64-curl
  • mingw64-x86_64-freeglut
  • mingw64-x86_64-gcc-g++
  • mingw64-x86_64-glew
  • mingw64-x86_64-glib-2.0
  • mingw64-x86_64-gtk3 (Recommended, but can be swapped out for SDL2 instead)
  • mingw64-x86_64-libepoxy
  • mingw64-x86_64-libusb1.0
  • mingw64-x86_64-pixman
  • mingw64-x86_64-pkg-config
  • mingw64-x86_64-usbredir
  • python3-setuptools

Note: This is with a fresh install of Cygwin and the same (minimal) set of packages used by the build runner. You may install more if you wish to use different or additional features, such as SDL. Note that gnutls may cause a "missing symbols" error relating to libidn2; if you encounter this you can disable it by providing the --disable-gnutls argument to the configure script.

Compiling

  1. Important: set core.autocrlf to FALSE if using a Windows git client; otherwise the build scripts will be checked out with CRLF line endings, and bash will be unhappy.
  2. Check out a copy of the repository.
  3. Launch Cygwin and move to this directory.
  4. Execute the configuration: ./configure --cross-prefix=x86_64-w64-mingw32- --target-list=buddy-softmmu --enable-gtk --enable-libusb (The --enable- arguments are not strictly necessary but will yell at you if dependencies are missing as opposed to silently disabling the feature)
  5. MinGW LD does not have a -no-pie argument, this is the default. Remove it from the configuration with sed -i 's/LDFLAGS_NOPIE=-no-pie/LDFLAGS_NOPIE=/g' build/config-host.mak
  6. Build with make -j[#threads], e.g make -j8
  7. Wait.
  8. Wait some more.
  9. ...
  10. Profit! (Your new binary, qemu-system-buddy[w].exe, will reside in the build folder. (The difference between the W and non-W version is purely whether a console (CMD) window is spawned if launched via double-click on an icon.
  11. Copy the DLLs required for the executable to run:
for i in `ldd qemu-system-buddy.exe | grep \"not found\" | cut -f2 | cut -d\" \" -f1 | sort | uniq`; do echo Copying $i; cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/$i .; done
  1. Recursively copy any DLL dependencies required by the newly copied files:
while `ldd *.dll | grep -q \"not found\"`; do for i in `ldd *.dll | grep \"not found\" | cut -f2 | cut -d\" \" -f1 | sort | uniq`; do echo Copying $i; cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/$i .; done; sleep 2; done"
  1. If you wish to relocate the build output, you will need the EXE, the DLLs, the assets folder, and an empty folder called pc-bios. in the new location. (Don't ask why - it's a hardcoded path, apparently and QEMU will hang on boot if it is absent)

  2. Launch your fresh build with your desired set of arguments: qemu-system-buddy[w].exe -machine prusa-mini -kernel [filename.[bin|bbf]] [options...]