编译: ipvsadm-1.26 编译错误问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
[root@SquidMaster241 ipvsadm - 1.26 ] # make
 
make  - C libipvs
 
make[ 1 ]: Entering directory ` / root / ipvsadm - 1.26 / libipvs'
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - - fPIC  - DLIBIPVS_USE_NL   - DHAVE_NET_IP_VS_H  - - o libipvs.o libipvs.c
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - - fPIC  - DLIBIPVS_USE_NL   - DHAVE_NET_IP_VS_H  - - o ip_vs_nl_policy.o ip_vs_nl_policy.c
 
ar rv libipvs.a libipvs.o ip_vs_nl_policy.o
 
ar: creating libipvs.a
 
-  libipvs.o
 
-  ip_vs_nl_policy.o
 
gcc  - shared  - Wl, - soname,libipvs.so  - o libipvs.so libipvs.o ip_vs_nl_policy.o
 
make[ 1 ]: Leaving directory ` / root / ipvsadm - 1.26 / libipvs'
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - g   - DVERSION = \ "1.26\" -DSCHEDULERS=\"" rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq "\" -DPE_LIST=\"" sip "\"   - DHAVE_NET_IP_VS_H  - - o ipvsadm.o ipvsadm.c
 
ipvsadm.c: In function ‘print_largenum’:
 
ipvsadm.c: 1383 : warning: field width should have  type  int ’, but argument  2  has  type  ‘size_t’
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - g   - DVERSION = \ "1.26\" -DSCHEDULERS=\"" rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq "\" -DPE_LIST=\"" sip "\"   - DHAVE_NET_IP_VS_H  - - o config_stream.o config_stream.c
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - g   - DVERSION = \ "1.26\" -DSCHEDULERS=\"" rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq "\" -DPE_LIST=\"" sip "\"   - DHAVE_NET_IP_VS_H  - - o dynamic_array.o dynamic_array.c
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - - o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs / libipvs.a   - lnl
 
ipvsadm.o: In function `parse_options':
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 432 : undefined reference to `poptGetContext'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 435 : undefined reference to `poptGetNextOpt'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 660 : undefined reference to `poptBadOption'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 502 : undefined reference to `poptGetNextOpt'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 667 : undefined reference to `poptStrerror'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 667 : undefined reference to `poptBadOption'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 670 : undefined reference to `poptFreeContext'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 677 : undefined reference to `poptGetArg'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 678 : undefined reference to `poptGetArg'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 679 : undefined reference to `poptGetArg'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 690 : undefined reference to `poptGetArg'
 
/ root / ipvsadm - 1.26 / ipvsadm.c: 693 : undefined reference to `poptFreeContext'
 
collect2: ld returned  1  exit status
 
make:  * * *  [ipvsadm] Error  1

解决办法:

    yum -y install kernel-headers   popt-static 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[root@SquidMaster241 ipvsadm - 1.26 ] # make clean
 
rm  - f ipvsadm ipvsadm.spec ipvsadm - 1.26 .tar.gz
 
rm  - rf debian / tmp
 
find .  - name  '*.[ao]'  - - name  "*~"  - - name  "*.orig"  \
 
     - - name  "*.rej"  - - name core | xargs rm  - f
 
make  - C libipvs clean
 
make[ 1 ]: Entering directory ` / root / ipvsadm - 1.26 / libipvs'
 
rm  - * .[ao]  * * .orig  * .rej core  * .so
 
make[ 1 ]: Leaving directory ` / root / ipvsadm - 1.26 / libipvs'
 
[root@SquidMaster241 ipvsadm - 1.26 ] # make
 
make  - C libipvs
 
make[ 1 ]: Entering directory ` / root / ipvsadm - 1.26 / libipvs'
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - - fPIC  - DLIBIPVS_USE_NL   - DHAVE_NET_IP_VS_H  - - o libipvs.o libipvs.c
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - - fPIC  - DLIBIPVS_USE_NL   - DHAVE_NET_IP_VS_H  - - o ip_vs_nl_policy.o ip_vs_nl_policy.c
 
ar rv libipvs.a libipvs.o ip_vs_nl_policy.o
 
ar: creating libipvs.a
 
-  libipvs.o
 
-  ip_vs_nl_policy.o
 
gcc  - shared  - Wl, - soname,libipvs.so  - o libipvs.so libipvs.o ip_vs_nl_policy.o
 
make[ 1 ]: Leaving directory ` / root / ipvsadm - 1.26 / libipvs'
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - g   - DVERSION = \ "1.26\" -DSCHEDULERS=\"" rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq "\" -DPE_LIST=\"" sip "\"  - DHAVE_POPT  - DHAVE_NET_IP_VS_H  - - o ipvsadm.o ipvsadm.c
 
ipvsadm.c: In function ‘print_largenum’:
 
ipvsadm.c: 1383 : warning: field width should have  type  int ’, but argument  2  has  type  ‘size_t’
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - g   - DVERSION = \ "1.26\" -DSCHEDULERS=\"" rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq "\" -DPE_LIST=\"" sip "\"  - DHAVE_POPT  - DHAVE_NET_IP_VS_H  - - o config_stream.o config_stream.c
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - g   - DVERSION = \ "1.26\" -DSCHEDULERS=\"" rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq "\" -DPE_LIST=\"" sip "\"  - DHAVE_POPT  - DHAVE_NET_IP_VS_H  - - o dynamic_array.o dynamic_array.c
 
gcc  - Wall  - Wunused  - Wstrict - prototypes  - - o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs / libipvs.a  - lpopt  - lnl
 
[root@SquidMaster241 ipvsadm - 1.26 ]
[root@SquidMaster241 ipvsadm - 1.26 ] #  make install
 
make  - C libipvs
 
make[ 1 ]: Entering directory ` / root / ipvsadm - 1.26 / libipvs'
 
make[ 1 ]: Nothing to be done  for  ` all '.
 
make[ 1 ]: Leaving directory ` / root / ipvsadm - 1.26 / libipvs'
 
if  [ !  - / sbin ]; then mkdir  - / sbin; fi
 
install  - 0755  ipvsadm  / sbin
 
install  - 0755  ipvsadm - save  / sbin
 
install  - 0755  ipvsadm - restore  / sbin
 
- / usr / man / man8 ] || mkdir  - / usr / man / man8
 
install  - 0644  ipvsadm. 8  / usr / man / man8
 
install  - 0644  ipvsadm - save. 8  / usr / man / man8
 
install  - 0644  ipvsadm - restore. 8  / usr / man / man8
 
- / etc / rc.d / init.d ] || mkdir  - / etc / rc.d / init.d
 
install  - 0755  ipvsadm.sh  / etc / rc.d / init.d / ipvsadm
 
[root@SquidMaster241 ipvsadm - 1.26 ] # ipvsadm

本文转自 swq499809608 51CTO博客,原文链接:http://blog.51cto.com/swq499809608/1554594