keepalived-1.2.2 编译出错问题解决

 

keepalived-1.2.2解包编译时有如下错误:

/usr/include/stdint.h:41: error: conflicting types for 'int64_t'
/usr/src/linux/include/linux/types.h:126: error: previous declaration of 'int64_t' was here
/usr/include/stdint.h:56: error: conflicting types for 'uint64_t'
/usr/src/linux/include/linux/types.h:124: error: previous declaration of 'uint64_t' was here
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:46: error: conflicting types for 'loff_t'
/usr/src/linux/include/linux/types.h:58: error: previous declaration of 'loff_t' was here
/usr/include/sys/types.h:62: error: conflicting types for 'dev_t'
/usr/src/linux/include/linux/types.h:22: error: previous declaration of 'dev_t' was here
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: error: conflicting types for 'timer_t'
/usr/src/linux/include/linux/types.h:31: error: previous declaration of 'timer_t' was here
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:204: error: conflicting types for 'u_int64_t'
/usr/src/linux/include/linux/types.h:125: error: previous declaration of 'u_int64_t' was here
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: error: conflicting types for 'fd_set'
/usr/src/linux/include/linux/types.h:21: error: previous declaration of 'fd_set' was here
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: error: conflicting types for 'blkcnt_t'
/usr/src/linux/include/linux/types.h:142: error: previous declaration of 'blkcnt_t' was here
make[2]: *** [ip_vs_nl_policy.o] Error 1

可以采用如下办法解决:

vi keepalived-1.2.2/keepalived/libipvs-2.6/ip_vs.h

将以下行
#include <asm/types.h>          /* For __uXX types */
#include <linux/types.h>        /* For __beXX types in userland */

#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>

替换为以下行
#include <asm/types.h>          /* For __uXX types */
#include <sys/types.h>
#include <linux/types.h>        /* For __beXX types in userland */

#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>

 也就是将#include <sys/types.h>放到#include <linux/types.h>的前面

 问题原因:循环引用问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值