[libvirt] ARM libvirt compiling error

Hello, I'm trying to set up a development environment on an Arndale (ARM Samsung Exynos 5250) board to work on sVirt. I'm using Debian 7.0, I've downloaded the source code from GIT and than: ./autogen.sh --prefix=$HOME/usr make but in the middle of make execution, the program fails with this error: conf/domain_conf.c: In function 'virDomainHostdevDefParseXML': conf/domain_conf.c:3915:36: error: 'next_unit' may be used uninitialized in this function [-Werror=uninitialized] conf/domain_conf.c:3886:9: note: 'next_unit' was declared here conf/domain_conf.c: At top level: cc1: error: unrecognized command line option "-Wno-unused-command-line-argument" [-Werror] I've solved this problem simply initializing the "next_unit" variable (file src/conf/domain_conf.c, line 3886). This is the diff between the original file and the modified one: 3886c3886 < int next_unit; ---
int next_unit = -1;
Another way to solve is obviously with --disable-werror, but I guess this is not the best way. My gcc version is 4.6.3 (Debian 4.6.3-14), kernel version is 3.8.0-rc4. Maybe it's only a compiler problem, but can anyone confirm this? Is it worth to submit a new bug report/patch the source? Regards, Michele -- *Michele Paolino ** *Virtual Open Systems* **Open Source KVM Virtualization Developments Multicore Systems Virtualization Porting Services *Web*:* *www.virtualopensystems.com*

On Mon, Jun 03, 2013 at 11:27:41AM +0200, Michele Paolino wrote:
Hello,
I'm trying to set up a development environment on an Arndale (ARM Samsung Exynos 5250) board to work on sVirt. I'm using Debian 7.0, I've downloaded the source code from GIT and than: ./autogen.sh --prefix=$HOME/usr make
but in the middle of make execution, the program fails with this error: conf/domain_conf.c: In function 'virDomainHostdevDefParseXML': conf/domain_conf.c:3915:36: error: 'next_unit' may be used uninitialized in this function [-Werror=uninitialized] conf/domain_conf.c:3886:9: note: 'next_unit' was declared here conf/domain_conf.c: At top level: cc1: error: unrecognized command line option "-Wno-unused-command-line-argument" [-Werror]
The problem is that the compiler is not clever enough to realize that we only use the 'next_unit' variable if found==true, and we will have initiailized it by then.
I've solved this problem simply initializing the "next_unit" variable (file src/conf/domain_conf.c, line 3886). This is the diff between the original file and the modified one: 3886c3886 < int next_unit; ---
int next_unit = -1;
This looks like the best way to make the compiler shut up.
Maybe it's only a compiler problem, but can anyone confirm this? Is it worth to submit a new bug report/patch the source?
We'd accept a patch initializing it as you suggest Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 06/04/2013 06:47 AM, Daniel P. Berrange wrote:
conf/domain_conf.c: In function 'virDomainHostdevDefParseXML': conf/domain_conf.c:3915:36: error: 'next_unit' may be used uninitialized in this function [-Werror=uninitialized]
Is it worth to submit a new bug report/patch the source?
We'd accept a patch initializing it as you suggest
In fact, it's already been patched, shortly after 1.0.6 was released: commit 4db39e3fee6ae75ea772767e72e276bccd10bb11 Author: Jiri Denemark <jdenemar@redhat.com> Date: Mon Jun 3 12:19:09 2013 +0200 Fix warning about using an uninitialized next_unit value Using an uninitialized value and a bool saying if the value is valid may confuse compilators. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Michele Paolino