acassen / keepalived

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

keepalived-1.2.22 with snmp support compilation problem on Debian 7 #360

Closed jslocinski closed 8 years ago

jslocinski commented 8 years ago

I'm trying to compile 1.2.22 on Deb 7.11 with custom kernel and fail on snmp. Without snmp support it goes fine. Would you point me pls what I am doing wrong pls?

[root@builder /usr/src/keepalived/keepalived-1.2.22] ./configure --with-kernel-dir=/usr/src/linux-headers-3.18.11/include --enable-sha1 --enable-snmp [root@builder /usr/src/keepalived/keepalived-1.2.22] make [...] gcc -I../include -I../../lib -g -O2 -I/usr/include/libnl3 -DNETSNMP_ENABLE_IPV6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.14/CORE -D_FORTIFY_SOURCE=2 -I/usr/include -DNETSNMP_NO_INLINE -DFEAT_SHA1 -I/usr/src/linux-headers-3.18.11/include/include -I/usr/src/linux-headers-3.18.11/include/include -I/usr/src/linux-headers-3.18.11/include/include -Wall -Wunused -Wstrict-prototypes -D_KRNL_26 -D_WITHLVS -D_HAVE_IPVSSYNCD -D_WITHVRRP -D_HAVE_VRRPVMAC -D_WITHOUT_ADDR_GENMODE -D_WITHSNMP -D_WITH_SNMPKEEPALIVED -D_WITH_SNMPCHECKER -D_WITHOUT_SNMPRFC -D_WITHOUT_SNMPRFCV2 -D_WITHOUT_SNMPRFCV3 -DLIBIPVS_USE_NL -D_WITHOUTLIBNL -D_WITH_VRRPAUTH -D_WITH_SOMARK -D_HAVELIBIPTC -D_WITHOUTLIBIPSET -D_WITHOUT_IPV4DEVCONF -D_WITHOUT_IF_H_LINK_HCOLLISION -D_WITHOUT_LINUX_NET_IF_HCOLLISION -D_HAVE_SOCKNONBLOCK -D_HAVE_SOCKCLOEXEC -D_HAVE_FIBROUTING -c snmp.c snmp.c:28:45: fatal error: net-snmp/agent/agent_sysORTable.h: No such file or directory compilation terminated. make[2]: * [snmp.o] Error 1 make[2]: Leaving directory `/usr/src/keepalived/keepalived-1.2.22/keepalived/core' make[1]: * [all] Error 1 make[1]: Leaving directory`/usr/src/keepalived/keepalived-1.2.22/keepalived' make: *\ [all] Error 2

When I play a bit with net-snmp sources and include them as follows: [root@builder /usr/src/keepalived/keepalived-1.2.22] ln -s /usr/src/net-snmp-5.7.3/include/net-snmp keepalived/include/ Then getting: [root@builder /usr/src/keepalived/keepalived-1.2.22] make make -C lib || exit 1; make[1]: Entering directory /usr/src/keepalived/keepalived-1.2.22/lib' fatal: Not a git repository (or any of the parent directories): .git make[1]: Leaving directory/usr/src/keepalived/keepalived-1.2.22/lib' make -C keepalived make[1]: Entering directory /usr/src/keepalived/keepalived-1.2.22/keepalived' make[2]: Entering directory/usr/src/keepalived/keepalived-1.2.22/keepalived/core' gcc -I../include -I../../lib -g -O2 -I/usr/include/libnl3 -DNETSNMP_ENABLE_IPV6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.14/CORE -D_FORTIFY_SOURCE=2 -I/usr/include -DNETSNMP_NO_INLINE -DFEAT_SHA1 -I/usr/src/linux-headers-3.18.11/include/include -I/usr/src/linux-headers-3.18.11/include/include -I/usr/src/linux-headers-3.18.11/include/include -Wall -Wunused -Wstrict-prototypes -D_KRNL_26 -D_WITHLVS -D_HAVE_IPVSSYNCD -D_WITHVRRP -D_HAVE_VRRPVMAC -D_WITHOUT_ADDR_GENMODE -D_WITHSNMP -D_WITH_SNMPKEEPALIVED -D_WITH_SNMPCHECKER -D_WITHOUT_SNMPRFC -D_WITHOUT_SNMPRFCV2 -D_WITHOUT_SNMPRFCV3 -DLIBIPVS_USE_NL -D_WITHOUTLIBNL -D_WITH_VRRPAUTH -D_WITH_SOMARK -D_HAVELIBIPTC -D_WITHOUTLIBIPSET -D_WITHOUT_IPV4DEVCONF -D_WITHOUT_IF_H_LINK_HCOLLISION -D_WITHOUT_LINUX_NET_IF_HCOLLISION -D_HAVE_SOCKNONBLOCK -D_HAVE_SOCKCLOEXEC -D_HAVE_FIBROUTING -c snmp.c In file included from ../include/net-snmp/utilities.h:39:0, from ../include/net-snmp/net-snmp-includes.h:71, from ../include/snmp.h:29, from snmp.c:23: ../include/net-snmp/library/system.h:178:29: error: conflicting types for ‘strtoull’ In file included from ../include/net-snmp/net-snmp-includes.h:31:0, from ../include/snmp.h:29, from snmp.c:23: /usr/include/stdlib.h:215:31: note: previous declaration of ‘strtoull’ was here make[2]: * [snmp.o] Error 1 make[2]: Leaving directory `/usr/src/keepalived/keepalived-1.2.22/keepalived/core' make[1]: * [all] Error 1 make[1]: Leaving directory`/usr/src/keepalived/keepalived-1.2.22/keepalived' make: *\ [all] Error 2

Did I miss sth?

BTW. What's the difference between snmp and snmp-keepalived?

Thanks for help

pqarmitage commented 8 years ago

In order to use the net-snmp headers, they have to go through a build process so that include/net-snmp/net-snmp-config-x86_64.h is configured appropriately. If you look in your version of that file, you will probably find it has a line #undef HAVE_STRTOULL whereas you need

define HAVE_STRTOULL 1`

This is because net-snmp-config-x86_64.h hasn't been configured for your system; simply changing that one line won't be sufficient.

The best thing to do would be either to install the Debian net-snmp package (although version 5.7.2 is a little old now), or build the package and install it yourself.

jslocinski commented 8 years ago

Thanks, missed the step with build the net-snmp in fact. I already have it installed from debian, but seems to be too old. After building the newest one and linking under include dir all went fine.

The version already installed in Debian: https://packages.debian.org/pl/wheezy/libsnmp-dev (5.4.3~dfsg-2.8+deb7u1) but it doesn't provide such file: [root@builder /usr/src/keepalived/keepalived-1.2.22] dpkg -L libsnmp-dev | grep agent_sysORTable.h

Best regards, Jakub S.