我要评分
获取效率
正确性
完整性
易理解

libvirt 5.6.0 Compilation Fails Occasionally

Symptom

When you compile libvirt 5.6.0 based on (Optional) Upgrading libvirt in the KVM Installation Guide, there is a probability (62.5%) that the compilation fails.

make[3]: Leaving directory '/root/rpmbuild/BUILD/libvirt-5.6.0/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory '/root/rpmbuild/BUILD/libvirt-5.6.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/rpmbuild/BUILD/libvirt-5.6.0'
make: *** [all] Error 2
error: Bad exit status from /var/tmp/tmp-tmp.5eNem7 (%build)

RPM build errors:
Bad exit status from /var/tmp/tmp-tmp.5eNem7 (%build)

Locate the line where the problem is prompted. One of the prompt information is found:

  • Prompt 1:
    gcc: error: ../src/libvirt_probes.o.dtrace-temp.c: No such file or directory
    gcc: fatal error: no input files
    compilation terminated.
    "gcc ../src/libvirt_probes.o.dtrace-temp.c" failed
  • Prompt 2:
    Traceback (most recent call last):
    File "usr/bin/dtrace", line 445, in <module>
    sys. exit (main())
    File "usr/bin/dtrace", line 432, in main
    os.remove (fname)
    OSError: [Errno 2] No such file or directory: '../src/libvirt_probes.o.dtrace-temp.c'

Both of them are caused by the failure to find a certain source code file.

Key Process and Cause Analysis

The Makefile of libvirt-5.6.0 has a defect. As a result, a bug occurs during concurrent compilation. It is caused by the src/remote/Makefile.inc.am file.

Conclusion and Solution

  1. Modify the /bin/dtrace file.
    vim /bin/dtrace

    In line 308, locate keep_temps = False, and change it to the following information:

    keep_temps = True

  2. Recompile libvirt to generate the RPM package and no error is reported. For details, see (Optional) Upgrading libvirt.