Showing posts with label gcc. Show all posts
Showing posts with label gcc. Show all posts

Mar 2, 2012

Repcached does not compile

If you want the tutorial on installing repcached, click here.

For the record, I am using:

Ubuntu 11.10 

Linux 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
GNU Make 3.81


If you're getting this error when doing make for repcached,



memcached.c: In function âadd_iovâ:
memcached.c:696:30: error: âIOV_MAXâ undeclared (first use in this function)
memcached.c:696:30: note: each undeclared identifier is reported only once for each function it appears in
memcached.c: In function âprocess_statâ:
memcached.c:1127:9: warning: format â%dâ expects argument of type âintâ, but argument 3 has type âlong unsigned intâ [-Wformat]
memcached.c:1134:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1138:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1139:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1140:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1141:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1142:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1143:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1144:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1145:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c:1146:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âsize_tâ [-Wformat]
memcached.c:1149:9: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c: In function âprocess_get_commandâ:
memcached.c:1331:19: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
memcached.c: In function âdo_add_deltaâ:
memcached.c:1573:5: warning: format â%lluâ expects argument of type âlong long unsigned intâ, but argument 3 has type âuint64_tâ [-Wformat]
make[2]: *** [memcached-memcached.o] Error 1
make[2]: Leaving directory `/root/memcached-1.2.8-repcached-2.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/memcached-1.2.8-repcached-2.2'
make: *** [all] Error 2


Related discussion here.

Compiler says that IOV_MAX is not defined. I'm not really sure what this is, but it compiled fine on Ubuntu 10.04. I guess that const is not used anymore.

In memcached.c code, we can see that IOV_MAX is defined if the OS is FreeBSD or iOS, so I decided to just define it anyway.

Here is my diff of the code that made it compile, in case you need it.

57,59c57
< #if defined(__FreeBSD__) || defined(__APPLE__)
< # define IOV_MAX 1024
< #endif
---
> #define IOV_MAX 1024