keepalived-1.2.2解包编译时有如下错误:
/usr/include/:41: error: conflicting types for 'int64_t'
/usr/src/linux/include/linux/:126: error: previous declaration of 'int64_t' was here
/usr/include/:56: error: conflicting types for 'uint64_t'
/usr/src/linux/include/linux/:124: error: previous declaration of 'uint64_t' was here
In file included from /usr/include/sys/:24,
from /usr/include/sys/socket.h:27,
from /usr/include/netinet/:24,
from ip_vs.h:12,
from ip_vs_nl_policy.c:1:
/usr/include/sys/:46: error: conflicting types for 'loff_t'
/usr/src/linux/include/linux/:58: error: previous declaration of 'loff_t' was here
/usr/include/sys/:62: error: conflicting types for 'dev_t'
/usr/src/linux/include/linux/:22: error: previous declaration of 'dev_t' was here
In file included from /usr/include/sys/:133,
from /usr/include/sys/:24,
from /usr/include/sys/:27,
from /usr/include/netinet/:24,
from ip_vs.h:12,
from ip_vs_nl_policy.c:1:
/usr/include/:105: error: conflicting types for 'timer_t'
/usr/src/linux/include/linux/:31: error: previous declaration of 'timer_t' was here
In file included from /usr/include/sys/:24,
from /usr/include/sys/:27,
from /usr/include/netinet/:24,
from ip_vs.h:12,
from ip_vs_nl_policy.c:1:
/usr/include/sys/:204: error: conflicting types for 'u_int64_t'
/usr/src/linux/include/linux/:125: error: previous declaration of 'u_int64_t' was here
In file included from /usr/include/sys/:220,
from /usr/include/sys/:24,
from /usr/include/sys/:27,
from /usr/include/netinet/:24,
from ip_vs.h:12,
from ip_vs_nl_policy.c:1:
/usr/include/sys/:78: error: conflicting types for 'fd_set'
/usr/src/linux/include/linux/:21: error: previous declaration of 'fd_set' was here
In file included from /usr/include/sys/:24,
from /usr/include/sys/:27,
from /usr/include/netinet/:24,
from ip_vs.h:12,
from ip_vs_nl_policy.c:1:
/usr/include/sys/:235: error: conflicting types for 'blkcnt_t'
/usr/src/linux/include/linux/: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/> /* For __uXX types */
#include <linux/> /* For __beXX types in userland */
#include <netinet/>
#include <sys/>
#include <sys/>
#include <arpa/>
替换为以下行
#include <asm/> /* For __uXX types */
#include <sys/>
#include <linux/> /* For __beXX types in userland */
#include <netinet/>
#include <sys/>
#include <arpa/>
也就是将#include <sys/>放到#include <linux/>的前面
问题原因:循环引用问题。