build fails with mingw gcc toolchain
<!-- See https://libvirt.org/bugs.html#how-to-file-high-quality-bug-reports --> ## Software environment - Operating system: Microsoft Windows 10.0.19045.xxxx - Architecture: x86_64 - kernel version: NT 10.0 - libvirt version: master branch - Hypervisor and version: unrelated - Compiler toolchain: gcc 12.2.0 and binutils 2.40 - Compiler target: x86_64-w64-mingw32 ## Description of problem Build fails with mingw gcc toolchain. First, the error is shown like the following: ``` $ ninja -C build ninja: Entering directory `build' [1/809] Generating src/util/virt_keycode_atset2 with a custom command (wrapped by meson to capture output) FAILED: src/util/virkeycodetable_atset2.h "F:/msys64/ucrt64/bin/meson" "--internal" "exe" "--capture" "src/util/virkeycodetable_atset2.h" "--" "sh" "F:/libvirt/scripts/meson-python.sh" "F:/msys64/ucrt64/bin/python3.EXE" "python" "F:/libvirt/src/keycodemapdb/tools/keymap-gen" "code-table" "--lang" "stdc" "--varname" "virKeyCodeTable_atset2" "F:/libvirt/src/keycodemapdb/data/keymaps.csv" "atset2" --- stderr --- F:\msys64\ucrt64\bin\python3.EXE: can't open file 'F:\\libvirt\\build\\python': [Errno 2] No such file or directory ``` The error looks similar as this commit in spice-gtk https://gitlab.freedesktop.org/spice/spice-gtk/-/commit/795318c8fad0288d86bd6a392c0f82be60d4b9da. So, I have tried after removing `python3_prog` in many meson.build files and it works. ```diff --- a/src/util/meson.build +++ b/src/util/meson.build @@ -146,7 +146,7 @@ foreach name : keycode_list input: keymap_src_file, output: 'virkeycodetable_@0@.h'.format(name), command: [ - meson_python_prog, python3_prog, keymap_gen_prog, 'code-table', + meson_python_prog, keymap_gen_prog, 'code-table', '--lang', 'stdc', '--varname', 'virKeyCodeTable_@0@'.format(name), '@INPUT@', name, ``` Second, after that workaround, compiler failed with unused variable errors like following. ``` src/rpc/virkeepaliveprotocol.c: In function 'xdr_keepalive_procedure': src/rpc/virkeepaliveprotocol.c:12:27: error: unused variable 'buf' [-Werror=unused-variable] 12 | register int32_t *buf; | ^~~ src/rpc/virnetprotocol.c: In function 'xdr_virNetMessageType': src/rpc/virnetprotocol.c:15:27: error: unused variable 'buf' [-Werror=unused-variable] 15 | register int32_t *buf; | ^~~ ``` ## Steps to reproduce 1. Clone the repository. 2. Copy-paste the meson configure command from this [PKGBUILD](https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-libvirt/PKGBUILD) file. 3. Compile. ## Additional information Feel free to ask any further information.
issue