perfwatcher / collectd-pw

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

write_top.c compilation error #6

Closed feraudet closed 11 years ago

feraudet commented 11 years ago

Hello,

I've these error when compiling collectd-pw on 32 bits Suse 10 : make[3]: Entering directory /root/collectd-5.3.0.20130510/src' /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 -fno-strict-aliasing -MT write_top_la-write_top.lo -MD -MP -MF .deps/write_top_la-write_top.Tpo -c -o write_top_la-write_top.lotest -f 'write_top.c' || echo './'write_top.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 -fno-strict-aliasing -MT write_top_la-write_top.lo -MD -MP -MF .deps/write_top_la-write_top.Tpo -c write_top.c -fPIC -DPIC -o .libs/write_top_la-write_top.o cc1: warnings being treated as errors write_top.c: In function ‘wt_config’: write_top.c:444: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘size_t’ write_top.c:446: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘size_t’ write_top.c:455: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘cdtime_t’ write_top.c:457: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘cdtime_t’ make[3]: *** [write_top_la-write_top.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

It work when I cast as recommended bellow.

ymettier commented 11 years ago

This seems to happen on 32bits hosts and not on 64bits hosts with gcc. However, the correct fix is to use format "%zu" to print size_t values, and "%" PRIu64 for uint64_t (cdtime_t is a uint64_t).

This is fixed in commit b54df9d06d154ac23ea36bd85a4b982478b019e5 and in release 5.2.1/5.3.0-20130516.