Summary:ASTERISK-15772: [patch] Can't build asterisk using just --with-netsnmp... seems to always want to use CONFIG_NETSNMP
Reporter:Philip Prindeville (pprindeville)Labels:
Date Opened:2010-03-08 14:42:23.000-0600Date Closed:2010-07-27 13:33:50
Versions:Frequency of
Environment:Attachments:( 0) asterisk.log
( 1) config.log-CONFIG_NETSNMP
( 2) config.log-with-netsnmp
( 3) with_netsnmp.patch.txt
Description:It's issue 15714 all over again, only with netsnmp instead of curl this time.

If you've built a different version of netsnmp (or patched it) and you want to build against that, you can't.

Configure will attempt to find net-snmp-config and run that...  which might not be in any place it will likely be discovered... and ignores where you've told 'configure' to actually find the headers and libraries.
Comments:By: Terry Wilson (twilson) 2010-06-16 14:13:27

I've been researching this, and I'm not entirely sure that it is a bug--or at least one that is easily fixable. We use the net-snmp-config utility (as we should) and it returns all kinds of things for the agent-libs.  On my machine:

terry@cesium:~/src/digium/asterisk/trunk$ net-snmp-config --agent-libs-Wl,-Bsymbolic-functions -L/usr/lib -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp -Wl,-E

The purpose of using this utility is so complex things like this do not have to be hard-coded anywhere. The only way I could see to make this work with a passed in directory would be to do some kind of search and replace on the net-snmp-config output--which seems quite brittle.

I think the real solution to this issue is to run configure with your PATH=/path/to/new/net-snmp-config:$PATH so that the proper net-snmp-config is found and the proper options can be set.

With that said, I'm attaching a patch that makes the AST_EXT_TOOL_CHECK take the directory passed via --with-*=${dir} and search for the *-config app in ${dir}/bin. This *should* find the correct installation of the library.

Please apply the batch, run ./bootstrap && ./configure --with-netsnmp=/your/path/to/netsnmp and test it out for me.

By: Terry Wilson (twilson) 2010-06-21 16:34:29

pprindeville: any chance to try out the attached patch? Does it work for you?

By: Digium Subversion (svnbot) 2010-06-23 15:53:48

Repository: asterisk
Revision: 272254

U   trunk/autoconf/ast_ext_tool_check.m4

r272254 | twilson | 2010-06-23 15:53:47 -0500 (Wed, 23 Jun 2010) | 10 lines

Honor the --with-${library}=path for AST_EXT_TOOL_CHECK

(closes issue ASTERISK-15772)
Reported by: pprindeville
     with_netsnmp.patch.txt uploaded by twilson (license 396)
Tested by: twilson

Review: https://reviewboard.asterisk.org/r/739/



By: Digium Subversion (svnbot) 2010-06-23 18:40:16

Repository: asterisk
Revision: 272440

_U  branches/1.6.2/
U   branches/1.6.2/autoconf/ast_ext_tool_check.m4
U   branches/1.6.2/configure

r272440 | twilson | 2010-06-23 18:40:16 -0500 (Wed, 23 Jun 2010) | 21 lines

Merged revisions 272254,272256 via svnmerge from

 r272254 | twilson | 2010-06-23 15:53:48 -0500 (Wed, 23 Jun 2010) | 10 lines
 Honor the --with-${library}=path for AST_EXT_TOOL_CHECK
 (closes issue ASTERISK-15772)
 Reported by: pprindeville
       with_netsnmp.patch.txt uploaded by twilson (license 396)
 Tested by: twilson
 Review: https://reviewboard.asterisk.org/r/739/
 r272256 | twilson | 2010-06-23 15:59:17 -0500 (Wed, 23 Jun 2010) | 2 lines
 Update configure when changing autconf m4 files...



By: Philip Prindeville (pprindeville) 2010-06-24 21:58:20

Sorry for the late response.  Had a couple of fires to put out.

Trying it now against, and can't get it to work.

We have netsnmp-config in $(TARGET_DIR)/usr/bin, but when I specify




This doesn't work.  Plus packages (like LUA) that used to build fine are now breaking because it's looking for an xxx-config file, but not every package supplies one.

By: Paul Belanger (pabelanger) 2010-06-25 07:01:41

A copy of your config.log would be helpful.

By: Terry Wilson (twilson) 2010-06-25 08:56:47

1) it should be net-snmp-config that it is looking for
2) it should be--with-netsnmp=${TARGET_DIR}/usr
3) There is absolutely no way this change could possibly affect lua since the change was to the ast_ext_tool_check.m4 file and lua doesn't use AST_EXT_TOOL_CHECK
4) We used a slightly different version of the patch, so don't try the above patch, try checking out 1.6.2 from SVN

By: Terry Wilson (twilson) 2010-06-25 09:51:52

And on 4), I meant to say "please". :-)

By: Philip Prindeville (pprindeville) 2010-06-26 13:32:35

Check out the asterisk.log attachment.

By: Terry Wilson (twilson) 2010-06-26 13:50:59

configure seems to be finding both lua and net-snmp-config. You still are not trying the updated patch that was actually committed and make sure you are actually regenerating the configure script with ./bootstrap.sh. Please jut check out the branch from svn and try that.

By: Philip Prindeville (pprindeville) 2010-06-26 14:47:56

I'm not sure why you'd say that.  Here's the patch I'm using:


The portion of the patch against "configure" doesn't take, but since I'm removing configure and running ./bootstrap.sh that's a moot point.

By: Terry Wilson (twilson) 2010-06-29 10:22:50

Sorry, I didn't notice the bootstrap.sh call. I was trying to view things on my phone while watching the World Cup. :-)

Anyway, configure is definitely finding your net-snmp-config file:

checking for net-snmp-config... /home/philipp/kernel/build_i586/root/usr/bin/net-snmp-config

But something is wrong. I really need to see the config.log file to do any real debugging on this, though. Not just the build output. I'm guessing that the netsnmp test compile failed. In my config.log it shows:

configure:20038: checking for net-snmp-config
configure:20057: found /usr/bin/net-snmp-config
configure:20069: result: /usr/bin/net-snmp-config
configure:20122: ccache gcc -o conftest -g -O2  -DNETSNMP_ENABLE_IPV6 -g -O2 -DNETSNMP_USE_INLINE -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.10/CORE -I. -I/usr/include  conftest.c -Wl,-Bsymbolic-functions -L/usr/lib -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp -Wl,-E >&5
configure:20122: $? = 0

I need to see what yours says to have any idea what is going on. As far as the claim that lua is broken, I don't see any way it could happen and also don't see any evidence in the log you posted. Are you sure there is an issue there?

By: Philip Prindeville (pprindeville) 2010-06-30 23:54:47

The first config.log file was generated with:

./configure ... \

the 2nd config.log was generated with:

./configure ... \

as the documentation suggests.

By: Terry Wilson (twilson) 2010-07-01 10:46:47

Yeah, the first example should fail. The second one should work (and does as far as the patch is concerned). The problem is pretty clear from the config.log:

uclibc/bin/ld: cannot find -lnetsnmphelpers
collect2: ld returned 1 exit status
configure:17736: $? = 1

There is either something wrong with your net-snmp install as it can't find one of the libraries that net-snmp-config is returning as a value, or it is possible that the wrong net-snmp-config is being called (though unlikely since it shows it finding the one you specified at /home/philipp/kernel/build_i586/root/usr/bin/net-snmp-config).

Can you give me the output of running net-snmp-config --agent-libs (via the $PATH) and also via the alternate specified location? I want to make sure that the alternate location is indeed returning -lnetsnmphelpers.

By: Philip Prindeville (pprindeville) 2010-07-12 13:45:07

Did some digging.  This seems to be related to (a) libnetsnmphelpers.so not being installed in 5.5, and (b) libtool attempts to relink against the build host's libc (sigh) when doing an install with DESTDIR set.  The latter is a known bug in libtool.


By: Terry Wilson (twilson) 2010-07-27 13:33:49

pprindeville: Since it looks like you found the problem outside of our build script, I'm going ahead and closing. Thanks!