acassen / keepalived

Keepalived
https://www.keepalived.org
GNU General Public License v2.0
3.9k stars 732 forks source link

Suggest adding dependency requirements in the INSTALL file #2437

Closed opsarno closed 1 week ago

opsarno commented 2 weeks ago

System Version

# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Install build packages

yum install make automake  openssl-devel libnl3-devel iptables-devel ipset-devel file-devel net-snmp-devel glib2-devel pcre2-devel libnftnl-devel libmnl-devel  systemd-devel  kmod-devel NetworkManager-libnm-devel

make err keepalived-2.2.8

[root@xxxx ~/down/keepalived-2.2.8]# make
Making all in lib
make[1]: Entering directory `/root/down/keepalived-2.2.8/lib'
make  all-am
make[2]: Entering directory `/root/down/keepalived-2.2.8/lib'
make[2]: Leaving directory `/root/down/keepalived-2.2.8/lib'
make[1]: Leaving directory `/root/down/keepalived-2.2.8/lib'
Making all in keepalived
make[1]: Entering directory `/root/down/keepalived-2.2.8/keepalived'
Making all in core
make[2]: Entering directory `/root/down/keepalived-2.2.8/keepalived/core'
  CC       track_process.o
In file included from ../../lib/rbtree.h:24:0,
                 from ../../lib/rbtree_ka.h:26,
                 from ../../lib/scheduler.h:40,
                 from ../../lib/notify.h:31,
                 from ../../keepalived/include/vrrp.h:41,
                 from ../../keepalived/include/track_process.h:31,
                 from track_process.c:50:
../../lib/rbtree_types.h:31:25: error: initializer element is not constant
 #define RB_ROOT (struct rb_root) { NULL, }
                         ^
track_process.c:65:33: note: in expansion of macro ‘RB_ROOT’
 static rb_root_t process_tree = RB_ROOT;
                                 ^
make[2]: *** [track_process.o] Error 1
make[2]: Leaving directory `/root/down/keepalived-2.2.8/keepalived/core'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/down/keepalived-2.2.8/keepalived'
make: *** [all-recursive] Error 1

make err keepalived-2.2.4

[root@xxxx ~/down/keepalived-2.2.4]# make
Making all in lib
make[1]: Entering directory `/root/down/keepalived-2.2.4/lib'
make  all-am
make[2]: Entering directory `/root/down/keepalived-2.2.4/lib'
make[2]: Leaving directory `/root/down/keepalived-2.2.4/lib'
make[1]: Leaving directory `/root/down/keepalived-2.2.4/lib'
Making all in keepalived
make[1]: Entering directory `/root/down/keepalived-2.2.4/keepalived'
Making all in core
make[2]: Entering directory `/root/down/keepalived-2.2.4/keepalived/core'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/down/keepalived-2.2.4/keepalived/core'
Making all in vrrp
make[2]: Entering directory `/root/down/keepalived-2.2.4/keepalived/vrrp'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/down/keepalived-2.2.4/keepalived/vrrp'
Making all in check
make[2]: Entering directory `/root/down/keepalived-2.2.4/keepalived/check'
  CC       check_nftables.o
In file included from /usr/include/sched.h:29:0,
                 from ../../keepalived/include/global_data.h:32,
                 from check_nftables.c:60:
check_nftables.c: In function ‘setup_rule_set_mark’:
check_nftables.c:166:8: error: ‘struct tcphdr’ has no member named ‘th_dport’
        offsetof(struct tcphdr, th_dport), sizeof(((struct tcphdr*)NULL)->th_dport));
        ^
check_nftables.c:166:72: error: ‘struct tcphdr’ has no member named ‘th_dport’
        offsetof(struct tcphdr, th_dport), sizeof(((struct tcphdr*)NULL)->th_dport));
                                                                        ^
In file included from /usr/include/sched.h:29:0,
                 from ../../keepalived/include/global_data.h:32,
                 from check_nftables.c:60:
check_nftables.c:169:8: error: ‘struct udphdr’ has no member named ‘uh_dport’
        offsetof(struct udphdr, uh_dport), sizeof(((struct udphdr*)NULL)->uh_dport));
        ^
check_nftables.c:169:72: error: ‘struct udphdr’ has no member named ‘uh_dport’
        offsetof(struct udphdr, uh_dport), sizeof(((struct udphdr*)NULL)->uh_dport));
                                                                        ^
make[2]: *** [check_nftables.o] Error 1
make[2]: Leaving directory `/root/down/keepalived-2.2.4/keepalived/check'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/down/keepalived-2.2.4/keepalived'
make: *** [all-recursive] Error 1

Until successfully compiled using keepalived-2.1.5 version.

opsarno commented 2 weeks ago

Suggest to add version range

pqarmitage commented 1 week ago

I think what you are asking for is rather difficult. nftables wasn't introduced into the kernel until 3.13 (see https://en.wikipedia.org/wiki/Nftables). However CentOS 7 uses kernel 3.10, and so nftables shouldn't be supported, but it appears that RedHat have backported nftables into their kernel 3.10. If we were to specify minimum versions we would say the minimum kernel for nftables support is 3.13, and yet the CentOS 3.10 kernel supports nftables (whether the backport has sufficient functionality to work with keepalived is another matter).

Our aim is to support all major distros and their versions that have not reached EOL. However this does not mean that we aim to support partially backported features, for example in the past features partially backported into the RHEL kernel have caused keepalived to fail to build, and specific tests have had to be included to cope with that in configure.ac.

The build problem you are experiencing was fixed by commit 73813f3 and the first version that was included in was v2.2.5. The problem is caused by the two alternatives for struct tcp and struct udp, and ensuring that the right one is used.