memcache编译安装(cygwin环境)
来源:程序员人生 发布时间:2015-05-05 07:54:58 阅读次数:4676次
最近尝试编译libevent,可是1直都编译不成功,所有,研究了1下memcahe的编译进程,希望能有所帮助(memcache的底层就是libevent)。
首先,在官网上下载memcache的源码包,我使用的是1.4.24这个版本(http://memcached.org/)
不多说,下载以后固然得tar xvf memcached⑴.4.24.tar.gz,然落后入memcached⑴.4.24的源码目录,接下来就能够开始编译了。
1.configure阶段
直接运行./configure,发现检测不通过,报错是缺少了libevent的库
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/
libevent我已是配置了,指定libevent目录
./configure --with-libevent=/usr/local/libevent
......
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing depfiles commands
OK,成功
2.make && make install阶段
直接履行make,本来以为已没甚么问题了,结果却是报错。
memcached.c:4810:13: 毛病:数组下标类型为‘char’ [-Werror=char-subscripts]
if ((ever[2] == '1' || ever[2] == '2') && !isdigit(ever[3])) {
产看源码,这段代码的功能是检测libevent版本,删掉“&& !isdigit(ever[3])”可以编译成功,但此时功能有问题,还应当把return false给屏蔽掉
再次履行make,成功了。
脑残的下1步:make install
3.启动&简单测试
启动memcache,这里对启动参数就不详细说了,默许端口是11211
ACER1@lizhibin /memcache/memcached⑴.4.24
$ which memcached.exe
/usr/local/bin/memcached.exe
ACER1@lizhibin /memcache/memcached⑴.4.24
$ memcached.exe -m 100
使用telnet进行连接
telnet 127.0.0.1 11211
stats
STAT pid 10040
STAT uptime 127
STAT time 1430374863
STAT version 1.4.24
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 0.015000
STAT rusage_system 0.000000
STAT curr_connections 10
STAT total_connections 11
STAT connection_structures 11
STAT reserved_fds 20
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 31
STAT bytes_written 21
STAT limit_maxbytes 104857600
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 0
STAT crawler_reclaimed 0
STAT crawler_items_checked 0
STAT lrutail_reflocked 0
END
安装成功!!
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠