在 Windows 10(64 位)下为 Windows 10(64 位)编译 QEMU

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

我使用这些命令在 Windows 10(64 位)(基本上遵循 these instructions)下编译了 QEMU (3.0.50):

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

但是,在控制台中启动 qemu-system-x86_64.exe 时,没有任何反应。我期待 window 出现。启动 exe 后不久,我得到了提示。没有任何内容打印到控制台。没有必要的 DLL 丢失。可能是什么问题?

最后我设法在 Windows 10 Home 64 位下编译和 运行 QEMU。 有一些陷阱:

  1. 由于 mingw 中的编译器错误(参见 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832 and https://www.mail-archive.com/qemu-devel@nongnu.org/msg557409.html),您必须使用 --disable-stack-protector 配置 QEMU 并且(一种解决方案)将函数 __stack_chk_fail 添加到源文件。
  2. 使用 --disable-werror 配置 QEMU。
  3. 从 makefile 中删除 Capstone 项目。

这是编译 qemu-system-x86_64.exe 的完整分步指南:

日期:2018-10-31

OS:微软Windows 10 家庭版 64 位

指南基于:https://wiki.qemu.org/Hosts/W32#Native_builds_with_MSYS2

  • 下载并安装msys2到C:\msys64: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe
  • 启动C:\msys64\mingw64.exe
  • 更新(然后关闭 window 并重新启动 mingw64.exe):pacman -Syu
  • 更新:pacman -Su
  • 安装基本包:pacman -S base-devel mingw-w64-x86_64-toolchain git python
  • 安装QEMU特定包:pacman -S mingw-w64-x86_64-glib2 mingw-w64-x86_64-gtk3 mingw-w64-x86_64-SDL2
  • 获取 QEMU 源代码:
    • git 克隆 git://git.qemu-project.org/qemu.git
    • cd qemu
    • git 子模块更新 --init ui/keycodemapdb
    • git 子模块更新 --init capstone
    • git 子模块更新 --init dtc
  • 插入 无效__stack_chk_fail(无效); 无效 __stack_chk_fail(无效) { } 到 qemu\util\oslib-win32.c 例如在第 44 行
  • 在 qemu\Makefile
  • 中注释掉 (#) Capstone(第 508 行)
  • 构建 QEMU:
    • ./configure --enable-gtk --enable-sdl --target-list=x86_64-softmmu --disable-werror --disable-stack-protector
    • 制作
  • 运行 在 qemu/x86_64-softmmu ./qemu-system-x86_64 -L ./../pc-bios
  • 可选(为了更好的性能):根据本指南安装 HAXM:https://www.qemu.org/2017/11/22/haxm-usage-windows/ 并使用选项 -accel hax
  • 启动 QEMU

我想知道是否有人在 2022 年尝试过我目前在编译后遇到了一些问题。 首先它要求 libzstd.dll,当我转到 google 找到的项目并 dl 这个 dll 时,我遇到了另一个问题

和x64.dll

与 x32.dll(以防万一)

我在 windows 10 pro x64 上使用 msys2 minGw x64。一开始我会编译一个补丁,但它与香草一样的问题,我问自己是否是环境问题,缺少dll,或者是否总是可以直接在windows10上编译,也许现在它只是可以跨平台编译。我完全不习惯使用 mingw64 工具。

我查找了 g_spanw... 错误并找到了这个 https://docs.gtk.org/glib/func.spawn_async_with_fds.html

也许我错了,但它只适用于 gnome,不是吗?