安装ipvsadm报错

安装ipvsadm报错ipvsadm 安装报错

服务器环境:

[vagrant@localhost download]$ uname -a

Linux RS1 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

[vagrant@localhost download]$ cat /etc/redhat-release 

CentOS release 5.6 (Final)

[vagrant@localhost download]$ 

ipvsadm版本(ipvsadm版本和linux内核是有对应关系的):

ipvsadm-1.24

编译报错:

[vagrant@localhost ipvsadm-1.24]$ make

make -C libipvs

make[1]: Entering directory `/home/vagrant/download/ipvsadm-1.24/libipvs’

gcc -Wall -Wunused -Wstrict-prototypes -g -O2 -I/usr/src/linux/include  -DHAVE_NET_IP_VS_H -c -o libipvs.o libipvs.c

In file included from libipvs.c:23:

libipvs.h:14:23: error: net/ip_vs.h: No such file or directory

In file included from libipvs.c:23:

libipvs.h:119: error: expected ‘)’ before ‘fwmark’

libipvs.c:27: error: field ‘svc’ has incomplete type

libipvs.c:28: error: field ‘dest’ has incomplete type

libipvs.c: In function ‘ipvs_init’:

libipvs.c:40: error: invalid application of ‘sizeof’ to incomplete type ‘struct ip_vs_getinfo’ 

libipvs.c:44: error: ‘IP_VS_SO_GET_INFO’ undeclared (first use in this function)

libipvs.c:44: error: (Each undeclared identifier is reported only once

libipvs.c:44: error: for each function it appears in.)

libipvs.c: In function ‘ipvs_getinfo’:

libipvs.c:56: error: invalid application of ‘sizeof’ to incomplete type ‘struct ip_vs_getinfo’ 

libipvs.c:57: error: ‘IP_VS_SO_GET_INFO’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_version’:

libipvs.c:64: error: invalid use of undefined type ‘struct ip_vs_getinfo’

libipvs.c: In function ‘ipvs_flush’:

libipvs.c:70: error: ‘IP_VS_SO_SET_FLUSH’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_add_service’:

libipvs.c:79: error: ‘IP_VS_SO_SET_ADD’ undeclared (first use in this function)

libipvs.c:79: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_update_service’:

libipvs.c:87: error: ‘IP_VS_SO_SET_EDIT’ undeclared (first use in this function)

libipvs.c:87: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_del_service’:

libipvs.c:95: error: ‘IP_VS_SO_SET_DEL’ undeclared (first use in this function)

libipvs.c:95: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_zero_service’:

libipvs.c:103: error: ‘IP_VS_SO_SET_ZERO’ undeclared (first use in this function)

libipvs.c:103: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_add_dest’:

libipvs.c:109: error: dereferencing pointer to incomplete type

libipvs.c:109: error: dereferencing pointer to incomplete type

libipvs.c:112: error: ‘IP_VS_SO_SET_ADDDEST’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_update_dest’:

libipvs.c:119: error: dereferencing pointer to incomplete type

libipvs.c:119: error: dereferencing pointer to incomplete type

libipvs.c:122: error: ‘IP_VS_SO_SET_EDITDEST’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_del_dest’:

libipvs.c:129: error: dereferencing pointer to incomplete type

libipvs.c:129: error: dereferencing pointer to incomplete type

libipvs.c:132: error: ‘IP_VS_SO_SET_DELDEST’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_set_timeout’:

libipvs.c:140: error: ‘IP_VS_SO_SET_TIMEOUT’ undeclared (first use in this function)

libipvs.c:141: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_start_daemon’:

libipvs.c:148: error: ‘IP_VS_SO_SET_STARTDAEMON’ undeclared (first use in this function)

libipvs.c:149: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_stop_daemon’:

libipvs.c:156: error: ‘IP_VS_SO_SET_STOPDAEMON’ undeclared (first use in this function)

libipvs.c:157: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_get_services’:

libipvs.c:166: error: dereferencing pointer to incomplete type

libipvs.c:167: error: invalid application of ‘sizeof’ to incomplete type ‘ipvs_service_entry_t’ 

libipvs.c:167: error: invalid use of undefined type ‘struct ip_vs_getinfo’

libipvs.c:172: error: dereferencing pointer to incomplete type

libipvs.c:172: error: invalid use of undefined type ‘struct ip_vs_getinfo’

libipvs.c:174: error: ‘IP_VS_SO_GET_SERVICES’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_cmp_services’:

libipvs.c:189: error: dereferencing pointer to incomplete type

libipvs.c:189: error: dereferencing pointer to incomplete type

libipvs.c:193: error: dereferencing pointer to incomplete type

libipvs.c:193: error: dereferencing pointer to incomplete type

libipvs.c:197: error: dereferencing pointer to incomplete type

libipvs.c:197: error: dereferencing pointer to incomplete type

libipvs.c:201: error: dereferencing pointer to incomplete type

libipvs.c:201: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_sort_services’:

libipvs.c:208: error: dereferencing pointer to incomplete type

libipvs.c:208: error: dereferencing pointer to incomplete type

libipvs.c:209: error: invalid application of ‘sizeof’ to incomplete type ‘ipvs_service_entry_t’ 

libipvs.c: In function ‘ipvs_get_dests’:

libipvs.c:218: error: dereferencing pointer to incomplete type

libipvs.c:218: error: invalid application of ‘sizeof’ to incomplete type ‘ipvs_dest_entry_t’ 

libipvs.c:218: error: dereferencing pointer to incomplete type

libipvs.c:224: error: dereferencing pointer to incomplete type

libipvs.c:224: error: dereferencing pointer to incomplete type

libipvs.c:225: error: dereferencing pointer to incomplete type

libipvs.c:225: error: dereferencing pointer to incomplete type

libipvs.c:226: error: dereferencing pointer to incomplete type

libipvs.c:226: error: dereferencing pointer to incomplete type

libipvs.c:227: error: dereferencing pointer to incomplete type

libipvs.c:227: error: dereferencing pointer to incomplete type

libipvs.c:228: error: dereferencing pointer to incomplete type

libipvs.c:228: error: dereferencing pointer to incomplete type

libipvs.c:231: error: ‘IP_VS_SO_GET_DESTS’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_cmp_dests’:

libipvs.c:243: error: dereferencing pointer to incomplete type

libipvs.c:243: error: dereferencing pointer to incomplete type

libipvs.c:247: error: dereferencing pointer to incomplete type

libipvs.c:247: error: dereferencing pointer to incomplete type

libipvs.c: In function ‘ipvs_sort_dests’:

libipvs.c:253: error: dereferencing pointer to incomplete type

libipvs.c:253: error: dereferencing pointer to incomplete type

libipvs.c:254: error: invalid application of ‘sizeof’ to incomplete type ‘ipvs_dest_entry_t’ 

libipvs.c: At top level:

libipvs.c:259: error: expected ‘)’ before ‘fwmark’

libipvs.c: In function ‘ipvs_get_timeout’:

libipvs.c:288: error: dereferencing pointer to incomplete type

libipvs.c:293: error: ‘IP_VS_SO_GET_TIMEOUT’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_get_daemon’:

libipvs.c:309: error: dereferencing pointer to incomplete type

libipvs.c:315: error: ‘IP_VS_SO_GET_DAEMON’ undeclared (first use in this function)

libipvs.c: In function ‘ipvs_strerror’:

libipvs.c:357: error: ‘ipvs_get_service’ undeclared (first use in this function)

make[1]: * [libipvs.o] Error 1

make[1]: Leaving directory `/home/vagrant/download/ipvsadm-1.24/libipvs’

make: * [libs] Error 2



打开Makefile,发现

INCLUDE         = -I/usr/src/linux/include -I.. -I.



其中路径/usr/src/linux在服务器并不存在。

需要做个软连接。

进入/usr/src目录

[vagrant@localhost src]$ pwd

/usr/src

[vagrant@localhost src]$ ll

total 20

drwxr-xr-x 2 root root 4096 Jan 26  2010 debug

drwxr-xr-x 3 root root 4096 Nov 21  2012 kernels

lrwxrwxrwx 1 root root   49 Nov 21  2012 vboxguest-4.2.0 -> /opt/VBoxGuestAdditions-4.2.0/src/vboxguest-4.2.0

ln -s生成一个软连接。

[vagrant@localhost src]$ sudo ln -s /usr/src/kernels/2.6.18-238.el5-x86_64/ /usr/src/linux

[vagrant@localhost src]$ ll

total 24

drwxr-xr-x 2 root root 4096 Jan 26  2010 debug

drwxr-xr-x 3 root root 4096 Nov 21  2012 kernels

lrwxrwxrwx 1 root root   39 May  5 09:59 linux -> /usr/src/kernels/2.6.18-238.el5-x86_64/

lrwxrwxrwx 1 root root   49 Nov 21  2012 vboxguest-4.2.0 -> /opt/VBoxGuestAdditions-4.2.0/src/vboxguest-4.2.0

再进行编译安装ipvsadm就成功了。





版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/202260.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月20日 上午7:32
下一篇 2026年3月20日 上午7:32


相关推荐

  • Zotero+zotfile+坚果云+PDF Expert超好用的多设备协同文献管理组合(保姆级别)

    Zotero+zotfile+坚果云+PDF Expert超好用的多设备协同文献管理组合(保姆级别)一 Zetero 的下载和安装点击左侧的 Download 即可下载安装时可以选择两个模式 standard 按照最通常的设置安装 没有办法改变安装位置 默认 C 盘 和 custom 可以改变安装位置 我选择了 custom 之后就选择好安装位置之后正常安装就可以二 下载常用插件 1 ZoteroConnec 可以在浏览器中收集论文到 zetero 中 点击 InstallEdgeC 即可以下载下载完成后会有一个 xpi 文件 选中后按空格即可以安装这个

    2025年11月18日
    6
  • AI Content Automation Platform · 开发日志 Day1

    AI Content Automation Platform · 开发日志 Day1

    2026年3月16日
    2
  • 如何在mac上安装虚拟机搭载Windows「建议收藏」

    如何在mac上安装虚拟机搭载Windows「建议收藏」一、下载虚拟机官方下载网址https://www.vmware.com/二、下载想要安装的Windows版本推荐下载网址https://msdn.itellyou.cn/(msdn建议收藏,相当全的系统)直接将地址复制到迅雷下载即可三、双击下载完成的vm虚拟机,拖到app中如果VM提示找不到可以连接的有效对等进程:…

    2025年11月6日
    5
  • 策略篇&访问策略 ❀ (5.4) 01. Explicit Web Proxy 显式web代理 ❀ 飞塔 (Fortinet) 防火墙

    策略篇&访问策略 ❀ (5.4) 01. Explicit Web Proxy 显式web代理 ❀ 飞塔 (Fortinet) 防火墙【简介】提供代理服务的计算机或其它类型的网络节点称为代理服务器,其具体过程为:客户端首先与代理服务器创建连接,接着发出一个对另外的目标服务器的文件或其它资源的连接请求,代理服务器通过与目标服务器连接或从缓存中取得请求的资源,并返回给客户端。通常在这个过程中,代理服务器可能改变客户端请求或服务器端响应的一些内容以满足各种代理需要。显式代理飞塔防火墙支持支持…

    2022年6月21日
    34
  • centos7 mbr lvm无损转换为gpt

    centos7 mbr lvm无损转换为gpt

    2026年3月15日
    2
  • Java继承超详细

    Java继承超详细前言继承是面向对象语法的三大特征之一 继承可以降低代码编写的冗余度 提高编程的效率 通过继承 子类获得了父类的成员变量和方法 一个子类如何继承父类的字段和方法 如何修改从父类继承过来的子类的方法呢 今天我们开始学习有关 Java 继承的知识 继承继承就是子类继承父类的特征和行为 使得子类对象 实例 具有父类的实例域和方法 或子类从父类继承方法 使得子类具有父类相同的行为 继承的作用 通过继承可以快速创建新的类 实现代码的重用 提高程序的可维护性 节省大量创建新类的时间 提高开发效率和开发质量

    2026年3月26日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号