Home  >  Q&A  >  body text

linux - 安装memcached却编译出错

已经安装了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呢?

黄舟黄舟2742 days ago713

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 13:30:30

    The problem has been solved because the Makefile has -Werror, which prevents warnings from being compiled. Just modify the Makefile and remove the -Werror parameter. -Werror means a warning is an error, that is, if a warning is generated during the compilation process, the compilation will not pass. The source code of memcached may not be written rigorously enough, and a warning appears.
    Thanks @大书 for the tip.

    reply
    0
  • ringa_lee

    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

    遇到了同样的问题

    reply
    0
  • Cancelreply