Bug 848665

Summary: qemu-kvm source code failed to compile after hack qemu-kvm.spec file
Product: Red Hat Enterprise Linux 6 Reporter: juzhang <juzhang>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.4CC: acathrow, bsarathy, dyasny, mkenneth, pbonzini, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-20 11:58:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description juzhang 2012-08-16 07:30:42 UTC
Description of problem:
download qemu-kvm-0.12.1.2-2.304.el6.src.rpm, hack qemu-kvm.spec file. qemu-kvm source code failed to compile 

#diff qemu-kvm.spec qemu-kvm.spec.bak
8177,8178c8177
< RPM_OPT_FLAGS="-fprofile-arcs -ftest-coverage -lgcov"
< extraldflags="-Wl,--build-id -fprofile-arcs -ftest-coverage -lgcov";
---
> extraldflags="-Wl,--build-id"; then 
#rpmbuild --bb /root/rpmbuild/SPECS/qemu-kvm.spec



Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.304.el6

How reproducible:
100%

Steps to Reproduce:
1.download qemu-kvm-0.12.1.2-2.304.el6.src.rpm
2.hack qemu-kvm.spec in order to do code coverage.
diff qemu-kvm.spec qemu-kvm.spec.bak
8177,8178c8177
< RPM_OPT_FLAGS="-fprofile-arcs -ftest-coverage -lgcov"
< extraldflags="-Wl,--build-id -fprofile-arcs -ftest-coverage -lgcov";
---
> extraldflags="-Wl,--build-id"; then 
#rpmbuild --bb /root/rpmbuild/SPECS/qemu-kvm.spec
3.compile the qemu-kvm
rpmbuild --bb /root/rpmbuild/SPECS/qemu-kvm.spec
  
Actual results:
make[1]: Leaving directory `/root/rpmbuild/BUILD/qemu-kvm-0.12.1.2/libhw64'
rm extboot.img vapic.o multiboot.o extboot.o linuxboot.raw linuxboot.img vapic.raw vapic.img multiboot.raw extboot.raw multiboot.img linuxboot.o
make[1]: Leaving directory `/root/rpmbuild/BUILD/qemu-kvm-0.12.1.2/pc-bios/optionrom'
error: Bad exit status from /var/tmp/rpm-tmp.860tjg (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.860tjg (%build)

#cat /var/tmp/rpm-tmp.860tjg
#!/bin/sh

  RPM_SOURCE_DIR="/root/rpmbuild/SOURCES"
  RPM_BUILD_DIR="/root/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-O2 -g"
  RPM_ARCH="x86_64"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="qemu-kvm"
  RPM_PACKAGE_VERSION="0.12.1.2"
  RPM_PACKAGE_RELEASE="2.304.el6"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/root/rpmbuild/BUILDROOT/qemu-kvm-0.12.1.2-2.304.el6.x86_64"
  export RPM_BUILD_ROOT
  
  PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH
  
  set -x
  umask 022
  cd "/root/rpmbuild/BUILD"
cd 'qemu-kvm-0.12.1.2'
# --build-id option is used fedora 8 onwards for giving info to the debug packages.
RPM_OPT_FLAGS="-fprofile-arcs -ftest-coverage -lgcov"
extraldflags="-Wl,--build-id -fprofile-arcs -ftest-coverage -lgcov";
buildldflags="VL_LDFLAGS=-Wl,--build-id"



# sdl outputs to alsa or pulseaudio depending on system config, but it's broken (#495964)
# alsa works, but causes huge CPU load due to bugs
# oss works, but is very problematic because it grabs exclusive control of the device causing other apps to go haywire
./configure --target-list=x86_64-softmmu \
            --prefix=/usr \
            --sysconfdir=/etc \
            --cpuconfdir=/usr/share/qemu-kvm/cpu-model \
            --audio-drv-list=pa,alsa \
            --audio-card-list=ac97,es1370 \
            --disable-strip \
            --extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \
            --extra-cflags="$RPM_OPT_FLAGS -fPIE -DPIE" \
            --disable-xen \
            --block-drv-whitelist=qcow2,raw,file,host_device,host_cdrom,qed \
            --disable-debug-tcg \
            --disable-sparse \
            --enable-werror \
            --disable-sdl \
            --disable-curses \
            --disable-curl \
            --disable-check-utests \
            --enable-vnc-tls \
            --enable-vnc-sasl \
            --disable-brlapi \
            --disable-bluez \
            --enable-docs \
            --disable-vde \
            --enable-linux-aio \
            --enable-kvm \
            --enable-spice \
            --enable-kvm-cap-pit \
            --enable-kvm-cap-device-assignment \
            --trace-backend=dtrace \
            --enable-smartcard \
            --disable-smartcard-nss \
            --enable-usb-redir \
             \
            --disable-rhev-features

echo "config-host.mak contents:"
echo "==="
cat config-host.mak
echo "==="


# generate the default config:
make x86_64-softmmu/config-devices.mak

# disable vmware_vga on the config:
sed -i -e '/CONFIG_VMWARE_VGA=y/d' x86_64-softmmu/config-devices.mak

make V=1 QEMU_PROG=qemu-kvm QEMU_BINDIR="/usr/libexec" \
     -j16 $buildldflags

Expected results:
qemu-kvm can be complied successfully

Additional info:
1.I tried qemu-kvm-0.12.1.2-2.265.src.rpm with the same steps and can be compiled successfully.
2. the configure command with lcov
#./configure' '--target-list=x86_64-softmmu' '--prefix=/usr' '--sysconfdir=/etc' '--cpuconfdir=/usr/share/qemu-kvm/cpu-model' '--audio-drv-list=pa,alsa' '--audio-card-list=ac97,es1370' '--disable-strip' '--extra-ldflags=-Wl,--build-id -fprofile-arcs -ftest-coverage -lgcov -pie -Wl,-z,relro -Wl,-z,now' '--extra-cflags=-fprofile-arcs -ftest-coverage -lgcov -fPIE -DPIE' '--disable-xen' '--block-drv-whitelist=qcow2,raw,file,host_device,host_cdrom,qed' '--disable-debug-tcg' '--disable-sparse' '--enable-werror' '--disable-sdl' '--disable-curses' '--disable-curl' '--disable-check-utests' '--enable-vnc-tls' '--enable-vnc-sasl' '--disable-brlapi' '--disable-bluez' '--enable-docs' '--disable-vde' '--enable-linux-aio' '--enable-kvm' '--enable-spice' '--enable-kvm-cap-pit' '--enable-kvm-cap-device-assignment' '--trace-backend=dtrace' '--enable-smartcard' '--disable-smartcard-nss' '--enable-usb-redir' '--disable-rhev-features

Comment 1 juzhang 2012-08-16 07:44:24 UTC
Update the error message
-g  -c -o console.o console.c
cc1: warnings being treated as errors
block/mirror.c: In function 'mirror_run':
block/mirror.c:89: error: 'ret' may be used uninitialized in this function
block/mirror.c:89: note: 'ret' was declared here
gcc -I/root/rpmbuild/BUILD/qemu-kvm-0.12.1.2/slirp -Werror -m64 -Wold-style-definition -Wold-style-declaration -I. -I/root/rpmbuild/BUILD/qemu-kvm-0.12.1.2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fprofile-arcs -ftest-coverage -lgcov -fPIE -DPIE  -I/usr/include/spice-server -I/usr/include/pixman-1 -I/usr/include/spice-1     -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -MMD -MP -MT cursor.o -O2 -g  -c -o cursor.o cursor.c
make: *** [block/mirror.o] Error 1
make: *** Waiting for unfinished jobs....
+ exit 0

Comment 2 juzhang 2012-08-16 08:15:44 UTC
additional infos.
If remove --enable-werror from spec file, compile successful

Comment 3 Paolo Bonzini 2012-08-20 11:58:59 UTC
I think I looked at it in the past and it is a false positive.  It will be fixed by the patches for bug 844627, I'll close it as a dup.

*** This bug has been marked as a duplicate of bug 844627 ***