qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] cannot build qemu with "--static" configure option


From: Mr Dash Four
Subject: Re: [Qemu-devel] cannot build qemu with "--static" configure option
Date: Wed, 23 Nov 2011 20:27:50 +0000
User-agent: Thunderbird 2.0.0.24 (X11/20110312)


> It fails some other way ):
> 
> $ make V=1
> gcc -m64 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 
> -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef 
> -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing  
> -fstack-protector-all -Wendif-labels -Wmissing-include-dirs -Wempty-body 
> -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self 
> -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition 
> -Wtype-limits  -I../linux-headers -I.. 
> -I/home/jcmvbkbc/ws/m/awt/emu/xtensa/qemu/target-i386 -DNEED_CPU_H -pthread 
> -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   
> -I/home/jcmvbkbc/ws/m/awt/emu/xtensa/qemu/linux-user/x86_64 
> -I/home/jcmvbkbc/ws/m/awt/emu/xtensa/qemu/linux-user -O2 -g  
> -Wl,--warn-common -m64 -static -g  -Wl,-T../config-host.ld 
> -Wl,-T,/home/jcmvbkbc/ws/m/awt/emu/xtensa/qemu/x86_64.ld  -o qemu-x86_64 
> ../libdis-user/i386-dis.o ../libuser/cache-utils.o ../libuser/cutils.o 
> ../libuser/envlist.o ../libuser/host-utils.o ../libuser/path.o 
> ../libuser/tcg-runtime.o ../libu
ser/trace.o ../libuser/trace/control.o ../libuser/trace/default.o cpu-exec.o 
cpu-uname.o cpuid.o disas.o elfload.o exec.o fpu/softfloat.o gdbstub.o helper.o 
ioport-user.o linuxload.o main.o mmap.o op_helper.o osdep.o oslib-posix.o 
qemu-thread-posix.o signal.o strace.o syscall.o tcg/optimize.o tcg/tcg.o 
thunk.o translate-all.o translate.o uaccess.o user-exec.o -lrt -pthread 
-pthread -lgthread-2.0 -lrt -lglib-2.0    -lm
> 
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x24):
>  undefined reference to `glib_mem__alloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x7c):
>  undefined reference to `glib_mem__alloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0xd0):
>  undefined reference to `glib_mem__alloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x128):
>  undefined reference to `glib_mem__alloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x17c):
>  undefined reference to `glib_mem__realloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x1d8):
>  undefined reference to `glib_mem__realloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x230):
>  undefined reference to `glib_mem__free_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x274):
>  undefined reference to `glib_mem__alloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gmem.o):(.note.stapsdt+0x2cc):
>  undefined reference to `glib_mem__realloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gslice.o):(.note.stapsdt+0x24):
>  undefined reference to `glib_slice__alloc_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gslice.o):(.note.stapsdt+0x70):
>  undefined reference to `glib_slice__free_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gdataset.o):(.note.stapsdt+0x24):
>  undefined reference to `glib_quark__new_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gdataset.o):(.note.stapsdt+0x70):
>  undefined reference to `glib_quark__new_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gdataset.o):(.note.stapsdt+0xbc):
>  undefined reference to `glib_quark__new_semaphore'
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/libglib-2.0.a(gdataset.o):(.note.stapsdt+0x108):
>  undefined reference to `glib_quark__new_semaphore'
I don't get that - I get *SUCCESS*!!! I am going to run this through the 
rpmbuild, so that I get a proper package done.

Peter, I hope you would be able to advice me on the following, if you can 
please: I have some ugly stuff in my qemu.spec file as follows:

========================================================================================================
%build
# By default we build everything, but allow x86 to build a minimal version
# with only similar arch target support
%if %{with_x86only}
    buildarch="i386-softmmu x86_64-softmmu i386-linux-user x86_64-linux-user"
%else
    buildarch="i386-softmmu x86_64-softmmu arm-softmmu cris-softmmu 
m68k-softmmu \
           mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu \
           sh4-softmmu sh4eb-softmmu \
           i386-linux-user x86_64-linux-user alpha-linux-user arm-linux-user \
           armeb-linux-user cris-linux-user m68k-linux-user mips-linux-user \
           mipsel-linux-user sh4-linux-user sh4eb-linux-user" \
%endif


# --build-id option is used fedora 8 onwards for giving info to the debug 
packages.
extraldflags="-Wl,--build-id";
buildldflags="VL_LDFLAGS=-Wl,--build-id"

%ifarch s390
# drop -g flag to prevent memory exhaustion by linker
%global optflags %(echo %{optflags} | sed 's/-g//')
sed -i.debug 's/"-g $CFLAGS"/"$CFLAGS"/g' configure
%endif

%ifarch %{ix86} x86_64
# 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=%{_prefix} \
            --sysconfdir=%{_sysconfdir} \
            --audio-drv-list=pa,sdl,alsa,oss \
            --disable-strip \
            --extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \
            --extra-cflags="%{optflags} -fPIE -DPIE" \
            --enable-spice \
            --enable-trace-backend=dtrace \
            --disable-werror \
            --disable-xen

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

make V=1 -j1 $buildldflags
./scripts/tracetool --dtrace --binary %{_bindir}/qemu-kvm \
  --target-arch x86_64 --target-type system --stap \
  --probe-prefix qemu.kvm < ./trace-events > qemu-kvm.stp
cp -a x86_64-softmmu/qemu-system-x86_64 qemu-kvm
make clean

%endif

./configure \
    --target-list="$buildarch" \
    --prefix=%{_prefix} \
    --sysconfdir=%{_sysconfdir} \
    --interp-prefix=%{_prefix}/qemu-%%M \
    --audio-drv-list=pa,sdl,alsa,oss \
    --disable-kvm \
    --disable-strip \
    --extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \
    --extra-cflags="%{optflags} -fPIE -DPIE" \
    --disable-xen \
%ifarch %{ix86} x86_64
    --enable-spice \
%endif
    --enable-trace-backend=dtrace \
    --disable-werror

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

make V=1 -j1 $buildldflags

gcc %{SOURCE6} -O2 -g -o ksmctl


%install
rm -rf $RPM_BUILD_ROOT

install -D -p -m 0755 %{SOURCE4} $RPM_BUILD_ROOT/lib/systemd/system/ksm.service
install -D -p -m 0644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ksm
install -D -p -m 0755 ksmctl $RPM_BUILD_ROOT/lib/systemd/ksmctl

install -D -p -m 0755 %{SOURCE7} 
$RPM_BUILD_ROOT/lib/systemd/system/ksmtuned.service
install -D -p -m 0755 %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}/ksmtuned
install -D -p -m 0644 %{SOURCE9} $RPM_BUILD_ROOT%{_sysconfdir}/ksmtuned.conf

%ifarch %{ix86} x86_64
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules
mkdir -p $RPM_BUILD_ROOT%{_bindir}/
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
mkdir -p $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset

install -m 0755 %{SOURCE2} 
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules/kvm.modules
install -m 0755 kvm/kvm_stat $RPM_BUILD_ROOT%{_bindir}/
install -m 0755 qemu-kvm $RPM_BUILD_ROOT%{_bindir}/
install -m 0644 qemu-kvm.stp $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/
install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
%endif

make prefix="${RPM_BUILD_ROOT}%{_prefix}" \
     bindir="${RPM_BUILD_ROOT}%{_bindir}" \
     sharedir="${RPM_BUILD_ROOT}%{_datadir}/%{name}" \
     mandir="${RPM_BUILD_ROOT}%{_mandir}" \
     docdir="${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" \
     datadir="${RPM_BUILD_ROOT}%{_datadir}/%{name}" \
     sysconfdir="${RPM_BUILD_ROOT}%{_sysconfdir}" install
chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man1/*
install -D -p -m 0644 -t ${RPM_BUILD_ROOT}%{qemudocdir} Changelog README TODO 
COPYING COPYING.LIB LICENSE

install -D -p -m 0644 qemu.sasl $RPM_BUILD_ROOT%{_sysconfdir}/sasl2/qemu.conf

rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/pxe*bin
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/pxe*rom
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/gpxe*rom
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/vgabios*bin
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/bios.bin
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/openbios-ppc
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/openbios-sparc32
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/openbios-sparc64
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/petalogix*.dtb
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/s390-zipl.rom
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/bamboo.dtb
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/slof.bin
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/spapr-rtas.bin
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/ppc_rom.bin

# the pxe gpxe images will be symlinks to the images on
# /usr/share/gpxe, as QEMU doesn't know how to look
# for other paths, yet.
pxe_link() {
  ln -s ../gpxe/$2.rom %{buildroot}%{_datadir}/%{name}/pxe-$1.rom
}

pxe_link e1000 8086100e
pxe_link ne2k_pci rtl8029
pxe_link pcnet pcnet32
pxe_link rtl8139 rtl8139
pxe_link virtio virtio-net
ln -s ../vgabios/VGABIOS-lgpl-latest.bin  
%{buildroot}/%{_datadir}/%{name}/vgabios.bin
ln -s ../vgabios/VGABIOS-lgpl-latest.cirrus.bin 
%{buildroot}/%{_datadir}/%{name}/vgabios-cirrus.bin
ln -s ../vgabios/VGABIOS-lgpl-latest.qxl.bin 
%{buildroot}/%{_datadir}/%{name}/vgabios-qxl.bin
ln -s ../vgabios/VGABIOS-lgpl-latest.stdvga.bin 
%{buildroot}/%{_datadir}/%{name}/vgabios-stdvga.bin
ln -s ../vgabios/VGABIOS-lgpl-latest.vmware.bin 
%{buildroot}/%{_datadir}/%{name}/vgabios-vmware.bin
ln -s ../seabios/bios.bin %{buildroot}/%{_datadir}/%{name}/bios.bin

mkdir -p $RPM_BUILD_ROOT%{_exec_prefix}/lib/binfmt.d
for i in dummy \
%ifnarch %{ix86} x86_64
    qemu-i386 \
%endif
%if !%{with_x86only}
%ifnarch arm
    qemu-arm \
%endif
%ifnarch ppc ppc64
    qemu-ppc \
%endif
%ifnarch sparc sparc64
    qemu-sparc \
%endif
%ifnarch sh4
    qemu-sh4 \
%endif
%endif
; do
  test $i = dummy && continue
  grep /$i:\$ %{SOURCE1} > $RPM_BUILD_ROOT%{_exec_prefix}/lib/binfmt.d/$i.conf
  chmod 644 $RPM_BUILD_ROOT%{_exec_prefix}/lib/binfmt.d/$i.conf
done < %{SOURCE1}

# For the qemu-guest-agent subpackage install the systemd
# service and udev rules.
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
install -m 0644 %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}
install -m 0644 %{SOURCE11} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
========================================================================================================

The ./configure options are easy to correct (even though I have no idea what 
the --extra-ldflags and --extra-cflags are for and whether I should keep 
these), but the rest of the stuff above is way, way over my head. What parts do 
you think I should keep and should I delete, do you have an idea?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]