Regarding Memcached source code running issue

344 views Asked by At

using the following link,tried running the memcached source code...

     https://devcenter.heroku.com/articles/process-model

while running it,configure command works properly.

when i'm running the make command,it throws the following error....How to solve this issue?

syscon@syscon-OptiPlex-3020:~/Documents/work/memcached-1.4.5$ sudo make make all-recursive make[1]: Entering directory /home/syscon/Documents/work/memcached-1.4.5' Making all in doc make[2]: Entering directory/home/syscon/Documents/work/memcached-1.4.5/doc' make all-am make[3]: Entering directory /home/syscon/Documents/work/memcached-1.4.5/doc' make[3]: Nothing to be done forall-am'. make[3]: Leaving directory /home/syscon/Documents/work/memcached-1.4.5/doc' make[2]: Leaving directory/home/syscon/Documents/work/memcached-1.4.5/doc' make[2]: Entering directory /home/syscon/Documents/work/memcached-1.4.5' gcc -std=gnu99 -DHAVE_CONFIG_H -I. -DNDEBUG -g -O2 -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -MT memcached-memcached.o -MD -MP -MF .deps/memcached-memcached.Tpo -c -o memcached-memcached.otest -f 'memcached.c' || echo './'memcached.c memcached.c: In function ‘complete_incr_bin’: memcached.c:1023:16: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] c->binary_header.request.cas == ITEM_get_cas(it))) { ^ memcached.c:1044:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] c->cas = ITEM_get_cas(it); ^ memcached.c:1061:17: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] c->cas = ITEM_get_cas(it); ^ memcached.c: In function ‘process_bin_get’: memcached.c:1193:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] rsp->message.header.response.cas = htonll(ITEM_get_cas(it)); ^ memcached.c: In function ‘process_bin_update’: memcached.c:1889:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] ITEM_set_cas(it, c->binary_header.request.cas); ^ memcached.c:1905:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] if (ITEM_get_cas(it) != 0) { ^ memcached.c: In function ‘process_bin_append_prepend’: memcached.c:1949:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] ITEM_set_cas(it, c->binary_header.request.cas); ^ memcached.c: In function ‘process_bin_delete’: memcached.c:2014:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] if (cas == 0 || cas == ITEM_get_cas(it)) { ^ memcached.c: In function ‘do_store_item’: memcached.c:2127:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] else if (ITEM_get_cas(it) == ITEM_get_cas(old_it)) { ^ memcached.c:2127:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] memcached.c:2144:25: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] (unsigned long long)ITEM_get_cas(old_it), ^ memcached.c:2145:25: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] (unsigned long long)ITEM_get_cas(it)); ^ memcached.c:2158:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] if (ITEM_get_cas(it) != 0) { ^ memcached.c:2160:17: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] if (ITEM_get_cas(it) != ITEM_get_cas(old_it)) { ^ memcached.c:2160:17: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] memcached.c:2202:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] c->cas = ITEM_get_cas(it); ^ memcached.c:2214:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] c->cas = ITEM_get_cas(it); ^ memcached.c: In function ‘process_get_command’: memcached.c:2592:45: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] (unsigned long long)ITEM_get_cas(it)); ^ memcached.c: In function ‘process_update_command’: memcached.c:2751:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] ITEM_set_cas(it, req_cas_id); ^ memcached.c: In function ‘do_add_delta’: memcached.c:2870:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0); ^ memcached.c: In function ‘main’: memcached.c:4630:13: error: variable ‘udp_port’ set but not used [-Werror=unused-but-set-variable] int udp_port; ^ cc1: all warnings being treated as errors make[2]: *** [memcached-memcached.o] Error 1 make[2]: Leaving directory/home/syscon/Documents/work/memcached-1.4.5' make[1]: * [all-recursive] Error 1 make[1]: Leaving directory `/home/syscon/Documents/work/memcached-1.4.5' make: * [all] Error 2

1

There are 1 answers

0
Alexandr On

cd memcached-1.4.5/

wget http://johntech-resource.googlecode.com/files/fix-strict-aliasing.patch

patch memcached.h fix-strict-aliasing.patch

./configure

nano Makefile # add -Wno-error=unused-but-set-variable to CFLAGS.

make

make install

it helped for me. Taken from
http://www.cnblogs.com/balaamwe/archive/2012/05/31/2528066.html