カーネルヘッダへの最近(2.6.20)の変更がいけない。

 

gcc -g -O2  -I/home/ktaka/Kernel/linux-2.6.20/include -I../include -I../../lib -Wall -Wunused -Wstrict-prototypes -D_KRNL_2_6_ -D_WITH_LINKWATCH_ -D_WITH_LVS_ -D_HAVE_IPVS_SYNCD_  -c vrrp_arp.c
In file included from /usr/include/net/ethernet.h:26,
                 from ../include/vrrp_arp.h:29,
                 from vrrp_arp.c:29:
/usr/include/sys/types.h:62: error: conflicting types for 'dev_t'
/home/ktaka/Kernel/linux-2.6.20/include/linux/types.h:22: error: previous declaration of 'dev_t' was here
/usr/include/sys/types.h:67: error: conflicting types for 'gid_t'
/home/ktaka/Kernel/linux-2.6.20/include/linux/types.h:54: error: previous declaration of 'gid_t' was here
/usr/include/sys/types.h:72: error: conflicting types for 'mode_t'
/home/ktaka/Kernel/linux-2.6.20/include/linux/types.h:24: error: previous declaration of 'mode_t' was here
/usr/include/sys/types.h:77: error: conflicting types for 'nlink_t'
/home/ktaka/Kernel/linux-2.6.20/include/linux/types.h:25: error: previous declaration of 'nlink_t' was here
/usr/include/sys/types.h:82: error: conflicting types for 'uid_t'
/home/ktaka/Kernel/linux-2.6.20/include/linux/types.h:53: error: previous declaration of 'uid_t' was here
In file included from /usr/include/sys/types.h:216,
                 from /usr/include/net/ethernet.h:26,
                 from ../include/vrrp_arp.h:29,
                 from vrrp_arp.c:29:
/usr/include/sys/select.h:78: error: conflicting types for 'fd_set'
/home/ktaka/Kernel/linux-2.6.20/include/linux/types.h:21: error: previous declaration of 'fd_set' was here
In file included from /usr/include/net/ethernet.h:26,
                 from ../include/vrrp_arp.h:29,
                 from vrrp_arp.c:29:
/usr/include/sys/types.h:231: error: conflicting types for 'blkcnt_t'
/home/ktaka/Kernel/linux-2.6.20/include/linux/types.h:152: error: previous declaration of 'blkcnt_t' was here
vrrp_arp.c: In function 'send_gratuitous_arp':
vrrp_arp.c:84: 警告: pointer targets in initialization differ in signedness
make[2]: *** [vrrp_arp.o] エラー 1
make[2]: ディレクトリ `/home/ktaka/SRC/keepalived-1.1.13/keepalived/vrrp' から出ます
make[1]: *** [all] エラー 1
make[1]: ディレクトリ `/home/ktaka/SRC/keepalived-1.1.13/keepalived' から出ます
make: *** [all] エラー 2

カーネルヘッダへの最近の変更がいけない。

ここでの変更が災いしているみたい。

http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.20.y.git;a=blobdiff;f=include/linux/if_packet.h;h=99393ef3af394b8bfd411ec65d95b4bd7c815191;hp=b92558549d27b847901b08ae10bf0ba3b6f73ae2;hb=62d0cfcb27cf755cebdc93ca95dabc83608007cd;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2

vi include/linux/if_packet.h

/*
#include <linux/types.h>
*/

のように修正して、コンパイルは通るようになった。

と思ったが、間違いでした。

コンパイルに失敗したソースディレクトリに移動し、カーネルヘッダディレクトリをインクルードディレクトリから外すと、gccは通る。

hogehoge:~/SRC/keepalived-1.1.13$ cd keepalived/vrrp/
hogehoge:~/SRC/keepalived-1.1.13/keepalived/vrrp$ gcc -g -O2  -I../include -I../../lib -Wall -Wunused -Wstrict-prototypes -D_KRNL_2_6_ -D_WITH_LINKWATCH_ -D_WITH_LVS_ -D_HAVE_IPVS_SYNCD_  -c vrrp_arp.c
vrrp_arp.c: In function 'send_gratuitous_arp':
vrrp_arp.c:84: 警告: pointer targets in initialization differ in signedness

元のディレクトリに戻り、makeで何とかコンパイルは通る。

どうやら、次のリリースで直してくれるみたい。↓ 

http://marc.info/?l=keepalived-devel&m=117494197921716&w=2