Maison > Questions et réponses > le corps du texte
已经安装了libevent
yum install libevent-devel
并且安装了一些编译工具
yum -y install gcc gcc-c++ libstdc++-devel
按照官方提示使用以下安装方法
wget http://memcached.org/latest
tar -zxvf memcached-1.x.x.tar.gz
cd memcached-1.x.x
./configure && make && make test && sudo make install
但当make的时候报错,信息如下:
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -fprofile-arcs -ftest-coverage -g -O2 -pthread -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -MT memcached_debug-slabs.o -MD -MP -MF .deps/memcached_debug-slabs.Tpo -c -o memcached_debug-slabs.o `test -f 'slabs.c' || echo './'`slabs.c
mv -f .deps/memcached_debug-slabs.Tpo .deps/memcached_debug-slabs.Po
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -fprofile-arcs -ftest-coverage -g -O2 -pthread -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -MT memcached_debug-items.o -MD -MP -MF .deps/memcached_debug-items.Tpo -c -o memcached_debug-items.o `test -f 'items.c' || echo './'`items.c
cc1: warnings being treated as errors
items.c: In function ‘crawler_crawl_q’:
items.c:1141: 警告:由于数据类型范围限制,比较结果永远为真
make[2]: *** [memcached_debug-items.o] 错误 1
make[2]: Leaving directory `/tmp/memcached-1.4.24'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/tmp/memcached-1.4.24'
make: *** [all] 错误 2
[root@localhost memcached-1.4.24]#
怎么才能成功安装memcached呢?
PHPz2017-04-17 13:30:30
问题已经解决了,是因为Makefile有-Werror让警告也不通通过编译,修改Makefile把-Werror参数去掉就可以。-Werror的意思是警告即错误,即编译过程中有警告产生就无法编译通过。而memcached的源代码也许写得不够严谨,出警告了。
感谢@大舒的提点。
ringa_lee2017-04-17 13:30:30
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -fprofile-arcs -ftest-coverage -g -O2 -pthread -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -MT memcached_debug-items.o -MD -MP -MF .deps/memcached_debug-items.Tpo -c -o memcached_debug-items.o test -f 'items.c' || echo './'
items.c
cc1: warnings being treated as errors
items.c: In function ‘crawler_crawl_q’:
items.c:1141: warning: comparison is always true due to limited range of data type
make[2]: *** [memcached_debug-items.o] Error 1
make[2]: Leaving directory /usr/local/src/memcached-1.4.24'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
/usr/local/src/memcached-1.4.24'
make: *** [all] Error 2
遇到了同样的问题