欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux下安装memcached出错的解决办法

程序员文章站 2022-05-23 08:51:03
...

在CentOS 5下安装memcached失败报如下错误:

[root@localhost memcached-1.4.20]# ./configure 
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/app/source/memcached-1.4.20':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

在网上稍微百度了一下“error: no acceptable C compiler found in $PATH” 这个关键词然后就找到了办法:

 

原因是缺少gcc组件。

 

于是一个命令搞定了:

yum -y install gcc

然后再次执行安装命令如下:

[root@localhost memcached-1.4.20]# ./configure 
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for icc in use... no
checking for clang in use... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether __SUNPRO_C is declared... no
checking for gcc option to accept ISO C99... -std=gnu99
checking whether gcc -std=gnu99 and cc understand -c and -o together... yes
checking sasl/sasl.h usability... no
checking sasl/sasl.h presence... no
checking for sasl/sasl.h... no
checking for gcov... /usr/bin/gcov
checking for main in -lgcov... yes
checking for library containing clock_gettime... -lrt
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for libevent directory... configure: error: libevent is required.  You can get it from http://www.monkey.org/~provos/libevent/

      If it's already installed, specify its path using --with-libevent=/dir/

[root@localhost memcached-1.4.20]# 

 

从上述的信息可以看到安装时候没有报之前的错误了,但是又报了一个缺少libevent的错误,没有办法,再去安装libevent

 

下载libevent

地址:https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz

然后解压进入解压后的目录,执行如下命令进行安装:

./configure -prefix=/usr;
make;
make install;

测试是或安装libevent成功的命令如下:

ls -al /usr/lib | grep libevent

 如果有输出,则说明安装完成。

 

然后进入memcached目录进行你要进行的安装步骤。

./configure --with-libevent=/usr;//路径为你之前安装libevent时安装的目录。
make;
make install;

 

 至于memcache有没有安装好,这里就不在验证了,毕竟这个只是一个解决错误的文章,还有我也是初学者,哈哈。

 

我觉得这篇文章写的很好,可以参考下:

http://www.cnblogs.com/zgx/archive/2011/08/10/2134097.html