Jo123
Jo123

Reputation: 331

Compile QEMU under Windows 10 (64-bit) for Windows 10 (64-bit)

I managed to compile QEMU (3.0.50) under Windows 10 (64-bit) (basically following these instructions) with these commands:

./configure --enable-gtk --enable-sdl
make

However, when starting qemu-system-x86_64.exe in a console, nothing happens. I expected a window showing up. Shortly after starting the exe, I'm getting back the prompt. Nothing printed out to the console. No necessary DLL is missing. What could be the problem?

Upvotes: 8

Views: 10358

Answers (2)

Vonkel.
Vonkel.

Reputation: 384

I would do know if somebody tried in 2022 i have currently some issues after compiling. Firt it asks for libzstd.dll, when i go to the project i found by google and dl this dll, i encounter another issue

with x64.dll

enter image description here

with x32.dll (just in case)

enter image description here

i use msys2 minGw x64 on windows 10 pro x64. At the beginning i would compile a patch, but it the same problem with vanilla, i ask myself if it's an environment problem, a missing dll, or if it's always possible to compile directly on windows10, perhaps now it's only possible to compile in cross platform. I'm not habit at all with mingw64 tools.

I looked for the g_spanw... error and found this https://docs.gtk.org/glib/func.spawn_async_with_fds.html

Perhaps i'm wrong but it's only for gnome, isn't it ?

Upvotes: 1

Jo123
Jo123

Reputation: 331

Finally I managed to compile and run QEMU under Windows 10 Home 64-bit. There are a few pitfalls:

  1. Due to a compiler bug in mingw (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832 and https://www.mail-archive.com/[email protected]/msg557409.html), you have to configure QEMU with --disable-stack-protector and (one solution) add the function __stack_chk_fail to a source file.
  2. Configure QEMU with --disable-werror.
  3. Remove Capstone project from makefile.

Here's a complete step-by-step guide for compiling qemu-system-x86_64.exe:

Date: 2018-10-31

OS: Microsoft Windows 10 Home 64-bit

Guide based on: https://wiki.qemu.org/Hosts/W32#Native_builds_with_MSYS2

  • Download and install msys2 to C:\msys64: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe
  • Start C:\msys64\mingw64.exe
  • Updates (then close window and restart mingw64.exe): pacman -Syu
  • Updates: pacman -Su
  • Install basic packets: pacman -S base-devel mingw-w64-x86_64-toolchain git python
  • Install QEMU specific packets: pacman -S mingw-w64-x86_64-glib2 mingw-w64-x86_64-gtk3 mingw-w64-x86_64-SDL2
  • Get QEMU sources:
    • git clone git://git.qemu-project.org/qemu.git
    • cd qemu
    • git submodule update --init ui/keycodemapdb
    • git submodule update --init capstone
    • git submodule update --init dtc
  • Insert void __stack_chk_fail(void); void __stack_chk_fail(void) { } to qemu\util\oslib-win32.c e.g. at line 44
  • Comment out (#) Capstone (line 508) in qemu\Makefile
  • Build QEMU:
    • ./configure --enable-gtk --enable-sdl --target-list=x86_64-softmmu --disable-werror --disable-stack-protector
    • make
  • Run in qemu/x86_64-softmmu ./qemu-system-x86_64 -L ./../pc-bios
  • Optional (for better performance): Install HAXM according to this guide: https://www.qemu.org/2017/11/22/haxm-usage-windows/ and start QEMU with option -accel hax

Upvotes: 11

Related Questions