[libvirt] Build fails on RHEL-5

Hey Stefan, When trying to build libvirt head on RHEL-5, I'm getting this error: gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../gnulib/lib -I../gnulib/lib -I../include -I../src/util -I../include -I/usr/include/libxml2 -DLIBDIR=\"/usr/local/lib\" -DBINDIR=\"/usr/local/libexec\" -DSBINDIR=\"/usr/local/sbin\" -DSYSCONF_DIR=\"/usr/local/etc\" -DLOCALEBASEDIR=\"/usr/local/share/locale\" -DPKGDATADIR=\"/usr/local/share/libvirt\" -DLOCAL_STATE_DIR=\"/usr/local/var\" -DGETTEXT_PACKAGE=\"libvirt\" -Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option -Werror -DIN_LIBVIRT -g -O2 -MT libvirt_conf_la-nwfilter_conf.lo -MD -MP -MF .deps/libvirt_conf_la-nwfilter_conf.Tpo -c conf/nwfilter_conf.c -fPIC -DPIC -o .libs/libvirt_conf_la-nwfilter_conf.o conf/nwfilter_conf.c:395: error: 'ETHERTYPE_IPV6' undeclared here (not in a function) make[3]: *** [libvirt_conf_la-nwfilter_conf.lo] Error 1 It seems that ETHERTYPE_IPV6 is not declared in /usr/include/net/ethernet.h in RHEL-5. We can probably get around this by adding (untested): #ifndef ETHERTYPE_IPV6 #define ETHERTYPE_IPV6 0x86dd #endif At the top of nwfilter_conf.c -- Chris Lalancette

On 04/05/2010 04:33 PM, Chris Lalancette wrote:
#ifndef ETHERTYPE_IPV6 #define ETHERTYPE_IPV6 0x86dd #endif
I did test this quickly, and while this helps, I then run into this error: gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../gnulib/lib -I../gnulib/lib -I../include -I../src/util -I../include -I/usr/include/libxml2 -DLIBDIR=\"/usr/local/lib\" -DBINDIR=\"/usr/local/libexec\" -DSBINDIR=\"/usr/local/sbin\" -DSYSCONF_DIR=\"/usr/local/etc\" -DLOCALEBASEDIR=\"/usr/local/share/locale\" -DPKGDATADIR=\"/usr/local/share/libvirt\" -DLOCAL_STATE_DIR=\"/usr/local/var\" -DGETTEXT_PACKAGE=\"libvirt\" -Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option -Werror -DIN_LIBVIRT -g -O2 -MT libvirt_conf_la-nwfilter_conf.lo -MD -MP -MF .deps/libvirt_conf_la-nwfilter_conf.Tpo -c conf/nwfilter_conf.c -fPIC -DPIC -o .libs/libvirt_conf_la-nwfilter_conf.o cc1: warnings being treated as errors conf/nwfilter_conf.c: In function 'virNWFilterDefParseNode': conf/nwfilter_conf.c:1130: warning: 'data_ptr' may be used uninitialized in this function conf/nwfilter_conf.c:1556: warning: 'found_i' may be used uninitialized in this function make[3]: *** [libvirt_conf_la-nwfilter_conf.lo] Error 1 It seems like the gcc in RHEL-5 might not be able to figure out that data_ptr can never be used uninitialized because it is protected by found. The situation with found_i is similar. Should we set these to default values to shut the compiler up? -- Chris Lalancette

Chris Lalancette <clalance@redhat.com> wrote on 04/05/2010 04:55:10 PM:
On 04/05/2010 04:33 PM, Chris Lalancette wrote:
#ifndef ETHERTYPE_IPV6 #define ETHERTYPE_IPV6 0x86dd #endif
I did test this quickly, and while this helps, I then run into this error:
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../gnulib/lib -I../gnulib/lib - I../include -I../src/util -I../include -I/usr/include/libxml2 - DLIBDIR=\"/usr/local/lib\" -DBINDIR=\"/usr/local/libexec\" - DSBINDIR=\"/usr/local/sbin\" -DSYSCONF_DIR=\"/usr/local/etc\" - DLOCALEBASEDIR=\"/usr/local/share/locale\" -DPKGDATADIR=\"/usr/ local/share/libvirt\" -DLOCAL_STATE_DIR=\"/usr/local/var\" - DGETTEXT_PACKAGE=\"libvirt\" -Wall -Wformat -Wformat-security - Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra - Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict- prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,- D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables - fdiagnostics-show-option -Werror -DIN_LIBVIRT -g -O2 -MT libvirt_conf_la-nwfilter_conf.lo -MD -MP -MF .deps/libvirt_conf_la- nwfilter_conf.Tpo -c conf/nwfilter_conf.c -fPIC -DPIC -o .libs/ libvirt_conf_la-nwfilter_conf.o cc1: warnings being treated as errors conf/nwfilter_conf.c: In function 'virNWFilterDefParseNode': conf/nwfilter_conf.c:1130: warning: 'data_ptr' may be used uninitialized in this function conf/nwfilter_conf.c:1556: warning: 'found_i' may be used uninitialized in this function make[3]: *** [libvirt_conf_la-nwfilter_conf.lo] Error 1
It seems like the gcc in RHEL-5 might not be able to figure out that
data_ptr
can never be used uninitialized because it is protected by found. The situation with found_i is similar. Should we set these to default values to shut the compiler up?
That's probably the right thing to do. I'll post a patch shortly. Stefan
-- Chris Lalancette
participants (2)
-
Chris Lalancette
-
Stefan Berger