Asterisk compile from source with snmp support


I am trying to compile and generate Asterisk from the source with snmp support.
I compiled netsnmp and have binaries in one folder. I tried to run Asterisk ./configure script with --with-libsnmp=“Folder of libsnmp” and -L"Folder of libsnmp" -lnetsnmpmibs -lnetsnmpagent -lnetsnmphelpers -lnetsnmp, both didn’t work.

Since Asterisk is not getting compiled with libsnmp support res_snmp module is not getting generated.

How to solve this issue?

Look at he log from configure and find out why it failed to detect libsnmp.

Make sure that make menuconfig has the feature selected, and if it doesn’t allow it to be selected, note which dependencies are broken.

Make sure you have the development package, not just the run time one, installed.

This is the configure command which i used

./configure --with-netsnmp="/home/ganesh/Downloads/out/usr/local" --with-jansson="/home/ganesh/Documents/Files/Source/libjansson/usr/local"

The message in Configure

checking for LOG_LPR in syslog.h… yes
checking for LOG_MAIL in syslog.h… yes
checking for LOG_NEWS in syslog.h… yes
checking for LOG_SYSLOG in syslog.h… yes
checking for LOG_UUCP in syslog.h… yes
checking for mandatory modules: JANSSON NETSNMP… fail

**configure: *****
configure: *** The NETSNMP installation appears to be missing or broken.
configure: *** Either correct the installation, or run configure
configure: *** including --without-netsnmp.

The mandatory modules check seems to be done late, not immediately after the actual check for the modules, so you need to look further back for the relevant …no line.

Also, as already noted, you may need to look at config.log (or even configure itself) to find out exactly what was tested for.

Full config.log

configure:23361: gcc -o conftest -g -O2  -g -O2 -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -g -O2 -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/home/ganesh/Downloads/snmp/libsnmp/usr/local/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/ganesh/Downloads/snmp/libsnmp/usr/local/usr/lib/x86_64-linux-gnu/perl/5.28/CORE -I/home/ganesh/Downloads/snmp/libsnmp/usr/local/usr/include/libnl3 -I/home/ganesh/Downloads/snmp/libsnmp/usr/local. -I/home/ganesh/Downloads/snmp/libsnmp/usr/local/usr/local/include  conftest.c -L/home/ganesh/Downloads/snmp/libsnmp/usr/local/usr/local/lib -lnetsnmpmibs -lnl-3 -ldl -lm -lpcre -lnetsnmpagent -lpcre -Wl,-E -lnetsnmp -lm -lcrypto >&5
conftest.c:244:12: fatal error: net-snmp/net-snmp-config.h: No such file or directory

net-snmp/net-snmp-config.h is missing. Look at the I options in the first line to see where it was looked for.

Also you seem to be using a “cert” version, but should normally only be doing so if you have a support contract with Sangoma. For normal use, you should be using 13.38.0, for Asterisk 13.

I tried giving the Include and lib path manually using

./configure --with-jansson=/home/ganesh/Downloads/snmp/libjansson/usr/local --with-netsnmp=/home/ganesh/Downloads/snmp/libsnmp/home/ganesh/Downloads/snmp/net-snmp-5.9 CFLAGS="-I/home/ganesh/Downloads/snmp/libsnmp/usr/local/include/net-snmp" LDFLAGS="-L/home/ganesh/Downloads/snmp/libsnmp/usr/local/lib"

still, I am getting the error

It is looking for net-snmp/net-snmp-config.h but net-snmp also appears as a directory component in some of the paths you are using, and others use similar. It seems unlikely that the same component would appear twice in a path. Please check the actual path name of the include file.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.