perfwatcher / collectd-pw

Collectd patched for PerfWatcher
GNU General Public License v2.0
4 stars 6 forks source link

nfs.c compile error #7

Closed feraudet closed 11 years ago

feraudet commented 11 years ago

Hello,

I've this warning treated as error when I compile collectd-pw on 32 bits Suse 10 : /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -DPREFIX='"/ehc/fs1/softs/collectd"' -DCONFIGFILE='"/ehc/fs1/softs/collectd/etc/collectd.conf"' -DLOCALSTATEDIR='"/ehc/fs1/softs/collectd/var"' -DPKGLOCALSTATEDIR='"/ehc/fs1/softs/collectd/var/lib/collectd"' -DPIDFILE='"/ehc/fs1/softs/collectd/var/run/collectd.pid"' -DPLUGINDIR='"/ehc/fs1/softs/collectd/lib/collectd"' -DPKGDATADIR='"/ehc/fs1/softs/collectd/share/collectd"' -Wall -Werror -g -O2 -MT nfs.lo -MD -MP -MF .deps/nfs.Tpo -c -o nfs.lo nfs.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -DPREFIX=\"/ehc/fs1/softs/collectd\" -DCONFIGFILE=\"/ehc/fs1/softs/collectd/etc/collectd.conf\" -DLOCALSTATEDIR=\"/ehc/fs1/softs/collectd/var\" -DPKGLOCALSTATEDIR=\"/ehc/fs1/softs/collectd/var/lib/collectd\" -DPIDFILE=\"/ehc/fs1/softs/collectd/var/run/collectd.pid\" -DPLUGINDIR=\"/ehc/fs1/softs/collectd/lib/collectd\" -DPKGDATADIR=\"/ehc/fs1/softs/collectd/share/collectd\" -Wall -Werror -g -O2 -MT nfs.lo -MD -MP -MF .deps/nfs.Tpo -c nfs.c -fPIC -DPIC -o .libs/nfs.o cc1: warnings being treated as errors nfs.c: In function ‘mountstats_compute_and_submit’: nfs.c:655: warning: dereferencing type-punned pointer will break strict-aliasing rules nfs.c:657: warning: dereferencing type-punned pointer will break strict-aliasing rules nfs.c: In function ‘dispatch_mountstats’: nfs.c:903: warning: dereferencing type-punned pointer will break strict-aliasing rules make[3]: * [nfs.lo] Error 1 make[3]: Leaving directory /root/collectd-5.3.0.20130510/src' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory/root/collectd-5.3.0.20130510/src' make[1]: *\ [all] Error 2 make[1]: Leaving directory `/root/collectd-5.3.0.20130510/src' make: * [all-recursive] Error 1

PS : gcc -v Using built-in specs. Target: i586-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix= --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=i586-suse-linux Thread model: posix gcc version 4.1.2 20070115 (SUSE Linux)

ymettier commented 11 years ago

This may be a bug with some versions of gcc and a workaround is to use CFLAGS="-fno-strict-aliasing". More info on this bug (id 41874) : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41874.

However, the code was updated with the light of this archived mail thread : http://gcc.gnu.org/ml/gcc-help/2006-08/msg00236.html

Fix is in commit 8959106a897951efca1a35bd1f1a22e9623400cc