Skip to content

unused include files caused comiple fail in mingw32 ENV

Software environment

  • Operating system: Fedora-39
  • Architecture: x86_64
  • kernel version: 6.6.2-201.fc39.x86_64
  • libvirt version: libvirt-9.7.0
  • Hypervisor and version: -

Description of problem

these two headers are no needed in src/cpu/cpu_loongarch.c and cause compile failure with mingw32 while do rpm build
<sys/wait.h>
<sys/resource.h>

see: https://gitlab.com/lixianglai/libvirt/-/blob/loongarch/src/cpu/cpu_loongarch.c?ref_type=heads#L28-29

Steps to reproduce

  1. git format -5 //generate patches
    rpm -ivh https://dl.fedoraproject.org/pub/fedora/linux/releases/39/Everything/source/tree/Packages/l/libvirt-9.7.0-1.fc39.src.rpm
  2. cd ~/rpmbuild
    (cd SOURCES; tar axf libvirt-9.7.0.tar.xz)
    (cd SOURCES/libvirt-9.7.0; patch -p1 < /path/to/*.patches)
  3. tar acf libvirt-9.7.0.tar.xz libvirt-9.7.0
  4. rpmbuild -bb SPECS/libvirt.spec

expected result:

no compile failure

real result:

FAILED: src/cpu/libvirt_cpu.a.p/cpu_loongarch.c.obj  
**i686-w64-mingw32-gcc** -Isrc/cpu/libvirt_cpu.a.p -Isrc/cpu _..<snip>.._ -o src/cpu/libvirt_cpu.a.p/cpu_loongarch.c.obj -c ../src/cpu/cpu_loongarch.c  
../src/cpu/cpu_loongarch.c:28:10: fatal error: sys/wait.h: No such file or directory  
   28 | #include <sys/wait.h>  
      |          ^~~~~~~~~~~~  

I've tried remove the two lines and recompile, all works fine; So I think It's safe to remove them

Edited by tcler.yin