[libvirt] libvirt cannot be built with -Werror on RHEL6RC(x86_64)

Wen Congyang wency at cn.fujitsu.com
Thu May 12 06:40:51 UTC 2011


My steps to build libvirt:
1. # export CFLAGS=-Werror
2. # ./autogen.sh
3. # make dist && rpmbuild --nodeps --define "_sourcedir `pwd`" -ba libvirt.spec
   ...
   checking for msgmerge... /usr/bin/msgmerge
   checking whether NLS is requested... yes
   checking for GNU gettext in libc... no
   checking for iconv... yes
   checking for GNU gettext in libintl... no
   checking whether to use NLS... no
   checking for UDEV... yes
   checking for PCIACCESS... yes
   ...
   + rm -f /home/wency/rpmbuild/BUILDROOT/libvirt-0.9.1-1.el6.x86_64/etc/libvirt/qemu/networks/default.xml
   + rm -f /home/wency/rpmbuild/BUILDROOT/libvirt-0.9.1-1.el6.x86_64/etc/libvirt/qemu/networks/autostart/default.xml
   + sed -i -e '/<uuid>/d' /home/wency/rpmbuild/BUILDROOT/libvirt-0.9.1-1.el6.x86_64/usr/share/libvirt/networks/default.xml
   + /usr/lib/rpm/find-lang.sh /home/wency/rpmbuild/BUILDROOT/libvirt-0.9.1-1.el6.x86_64 libvirt
   No translations found for libvirt in /home/wency/rpmbuild/BUILDROOT/libvirt-0.9.1-1.el6.x86_64
   error: Bad exit status from /var/tmp/rpm-tmp.nSgCNo (%install)


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

4. # cat config.log
   ...
configure:82567: checking for GNU gettext in libc
configure:82596: gcc -std=gnu99 -o conftest -Werror   conftest.c -ldl  >&5
cc1: warnings being treated as errors
conftest.c: In function 'main':
conftest.c:468: error: cast from pointer to integer of different size
configure:82603: $? = 1
configure: failed program was:
...
| int
| main ()
| {
| bindtextdomain ("", "");
| return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings
|   ;
|   return 0;
| }
configure:82623: result: no
...

5. # cat po/Makefile.in.in
...
install: install-exec install-data
install-exec:
install-data: install-data- at USE_NLS@
        if test "$(PACKAGE)" = "gettext-tools"; then \
          $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
          for file in $(DISTFILES.common) Makevars.template; do \
            $(INSTALL_DATA) $(srcdir)/$$file \
                            $(DESTDIR)$(gettextsrcdir)/$$file; \
          done; \
          for file in Makevars; do \
            rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
          done; \
        else \
          : ; \
        fi
install-data-no: all
install-data-yes: all
        $(mkinstalldirs) $(DESTDIR)$(datadir)
...
gettext() returns char *, and we try to convert it to int. The size of pointer
and int is different, and gcc will give a warning. I build it with -Werror, so
the test program can not be built, and NLS is disabled. But We only install
translations when NLS is enabled.




More information about the libvir-list mailing list