# 编译magent
cd /home/lnmp/src mkdir magent cd magent/ wget http://memagent.googlecode.com/files/magent-0.5.tar.gz tar zxvf magent-0.5.tar.gz /sbin/ldconfig && sed -i "s#LIBS = -levent#LIBS = -levent -lm#g" Makefile make mkdir -p /usr/local/webserver/magent/bin cp magent /usr/local/webserver/magent/bin/magent cd ../
错误1:
gcc -lrt -Wall -g -O2 -I/usr/local/include -m64 -c -o magent.o magent.c
magent.c: In function ‘writev_list’:
magent.c:729: error: ‘SSIZE_MAX’ undeclared (first use in this function)
magent.c:729: error: (Each undeclared identifier is reported only once
magent.c:729: error: for each function it appears in.)
make: *** [magent.o] Error 1
解决办法:
vim Makefile
加入
#ifndef SSIZE_MAX # define SSIZE_MAX 32767 #endif
错误2:
gcc -Wall -g -O2 -I/usr/local/include -m64 -c -o magent.o magent.c
gcc -Wall -g -O2 -I/usr/local/include -m64 -c -o ketama.o ketama.c
gcc -Wall -g -O2 -I/usr/local/include -m64 -o magent magent.o ketama.o /usr/lib64/libevent.a /usr/lib64/libm.a
/usr/lib64/libevent.a(event.o): In function `gettime’:
(.text+0×449): undefined reference to `clock_gettime’
/usr/lib64/libevent.a(event.o): In function `event_base_new’:
(.text+0x72a): undefined reference to `clock_gettime’
collect2: ld returned 1 exit status
make: *** [magent] Error 1
解决办法
vim Makefile
CFLAGS = -Wall -g -O2 -I/usr/local/include $(M64)
改为:
CFLAGS = -lrt -Wall -g -O2 -I/usr/local/include $(M64)
1楼 于 2011-12-31 15:31
gcc -lm -lrt -Wall -g -O2 -I/usr/local/include -c -o magent.o magent.c
magent.c: In function ‘writev_list’:
magent.c:729: error: ‘SSIZE_MAX’ undeclared (first use in this function)
magent.c:729: error: (Each undeclared identifier is reported only once
magent.c:729: error: for each function it appears in.)
magent.c: In function ‘server_accept’:
magent.c:1893: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
make: *** [magent.o] 错误 1
知道这个错误是什么原因吗?
2楼 于 2011-12-31 15:32
安装你上面的方式处理,还是报错,有没有其他高招了啊,谢谢!