解决keepalived安装错误一例

Keepalived安装错误一例(make错误)
在make的时候出现了下面错误:
===============================================================
/usr/include/sys/types.h:62: 错误:与 ‘dev_t’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:22: 错误:‘dev_t’ 的上一个声明在此
/usr/include/sys/types.h:67: 错误:与 ‘gid_t’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:54: 错误:‘gid_t’ 的上一个声明在此
/usr/include/sys/types.h:72: 错误:与 ‘mode_t’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:24: 错误:‘mode_t’ 的上一个声明在此
/usr/include/sys/types.h:77: 错误:与 ‘nlink_t’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:25: 错误:‘nlink_t’ 的上一个声明在此
/usr/include/sys/types.h:82: 错误:与 ‘uid_t’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:53: 错误:‘uid_t’ 的上一个声明在此
In file included from /usr/include/sys/types.h:133,
                 from /usr/include/sys/uio.h:24,
                 from /usr/include/sys/socket.h:27,
                 from /usr/include/netinet/in.h:24,
                 from ip_vs.h:12,
                 from ip_vs_nl_policy.c:1:
/usr/include/time.h:105: 错误:与 ‘timer_t’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:31: 错误:‘timer_t’ 的上一个声明在此
In file included from /usr/include/sys/types.h:220,
                 from /usr/include/sys/uio.h:24,
                 from /usr/include/sys/socket.h:27,
                 from /usr/include/netinet/in.h:24,
                 from ip_vs.h:12,
                 from ip_vs_nl_policy.c:1:
/usr/include/sys/select.h:78: 错误:与 ‘fd_set’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:21: 错误:‘fd_set’ 的上一个声明在此
In file included from /usr/include/sys/uio.h:24,
                 from /usr/include/sys/socket.h:27,
                 from /usr/include/netinet/in.h:24,
                 from ip_vs.h:12,
                 from ip_vs_nl_policy.c:1:
/usr/include/sys/types.h:235: 错误:与 ‘blkcnt_t’ 类型冲突
/usr/src/kernels/2.6.18-238.19.1.el5-i686//include/linux/types.h:142: 错误:‘blkcnt_t’ 的上一个声明在此
make[2]: *** [ip_vs_nl_policy.o] 错误 1
make[2]: Leaving directory `/usr/local/src/keepalived-1.2.2/keepalived/libipvs-2.6'
make[1]: *** [all] 错误 1
make[1]: Leaving directory `/usr/local/src/keepalived-1.2.2/keepalived'
make: *** [all] 错误 2
===============================================================

我的编译参数是这样的:

./configure --prefix=/usr/local/keepalived --with-kernel-dir=/usr/src/kernels/2.6.18-238.19.1.el5-i686/

解决方法:
进入源码目录就是你解压的目录了:
cd /usr/local/src/keepalived-1.2.2

vi keepalived/libipvs-2.6/ip_vs.h
找到下面一行:
#include <linux/types.h>        /* For __beXX types in userland */

把他放到下面一行的下面:
#include <sys/types.h>

我想我说明白了,这是最新版本的问题,如果用keepalived-1.2.1则不会出现这个问题了,我用的是keepalived-1.2.2宝贝。

你可能感兴趣的:(安装,keepalived,Make,错误)