关于Memcached源代码运行问题

时间:2014-11-13 05:44:59

标签: memcached libmemcached

使用以下链接,尝试运行memcached源代码......

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

运行时,configure命令正常工作。

当我运行make命令时,它会抛出以下错误....如何解决这个问题?

syscon @syscon-OptiPlex-3020:〜/ Documents / work / memcached-1.4.5 $ sudo make 使所有递归 make [1]:输入目录/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 [3]:输入目录/home/syscon/Documents/work/memcached-1.4.5/doc' make[3]: Nothing to be done for all-am'。 make [3]:离开目录/home/syscon/Documents/work/memcached-1.4.5/doc' make[2]: Leaving directory / home / syscon / Documents / work / memcached-1.4.5 / doc' make [2]:输入目录/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.o test -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]错误1 make [1]:离开目录`/home/syscon/Documents/work/memcached-1.4.5' make:* [all]错误2

1 个答案:

答案 0 :(得分:1)

cd memcached-1.4.5 /

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

patch memcached.h fix-strict-aliasing.patch

./配置

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

make install

这对我有帮助。 取自
http://www.cnblogs.com/balaamwe/archive/2012/05/31/2528066.html