Re: [Linuxptp-devel] [PATCH_SNMPD_v2 4/6] snmpd: Add snmp sub agent
On Fri, Jun 15, 2018 at 07:36:01AM -0700, Richard Cochran wrote: > Yes, please post v2, and I will test it with cross compiling, with and I mean, v3 of course. Thanks, Richard -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] [PATCH_SNMPD_v2 4/6] snmpd: Add snmp sub agent
On Fri, Jun 15, 2018 at 12:30:15PM +, Anders Selhammer wrote: > # Look for libsnmp presence > for d in $dirs; do > files=$(find $d -type f -name net-snmp-agent-includes.h) > for f in $files; do > if grep -q NET_SNMP_AGENT_INCLUDES_H $f; then > printf " `net-snmp-config --cflags`" This won't work. The 'dirs' are only the built in include paths from gcc, and the sysroot containing net-snmp-config will be somewhere else. Let's try something else: If CROSS_COMPILE is empty, just test `which net-snmp-config`, and if it doesn't fail, then use the output of net-snmp-config. If CROSS_COMPILE is non-empty, then check that `which net-snmp-config` is not /usr/bin/net-snmp-config. If so, then use its output. If the user puts the sysroot's /usr/bin first in the PATH the we will have the correct net-snmp-config program. That net-snmp-config is a shell script, and so it will run on the build machine in a cross environment. > break 2 "break 2" - that's cute. Didn't know you could do that. > fi > done > done > A suggestion from the guy with the envir was to build a dummy program > including > the lib and neglect build errors (if any) from that build. If it succeeds, > build in snmp, > otherwise skip it. no, No, NO! That is the path of autoconf madness, and we will never ever go there. > I have not found anything that points to that netsnmp provide pkg-config > files. > Neither google nor search in lib has given me anything that point in that > direction. I checked libsnmp-dev in debian, and it doesn't have the pkg-config .pc files. > Will you be able to try this cross compiling and see if it works with the > updated > version (I can send in a updated version if that is the case)? Yes, please post v2, and I will test it with cross compiling, with and without libsnmp. There are four cases: 1. build machine doesn't have libsnmp, cross sysroot doesn't either 2. build machine has libsnmp, cross sysroot doesn't 3. build machine has libsnmp, cross sysroot does as well 4. build machine doesn't have libsnmp, cross sysroot does have it Thanks, Richard -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Re: [Linuxptp-devel] [PATCH_SNMPD_v2 4/6] snmpd: Add snmp sub agent
Thursday, June 14, 2018 6:40 AM > This won't work when cross compiling. That is an important use case, > and we should support it. Will do the check like done for clock_adjtime user_flags() { # Needed for vasprintf(). printf " -D_GNU_SOURCE" # Get list of directories searched for header files. dirs=$(echo "" | ${CROSS_COMPILE}cpp -Wp,-v 2>&1 >/dev/null | grep ^" /") # Look for clock_adjtime(). ... # Look for posix_spawn(). ... # Look for libsnmp presence for d in $dirs; do files=$(find $d -type f -name net-snmp-agent-includes.h) for f in $files; do if grep -q NET_SNMP_AGENT_INCLUDES_H $f; then printf " `net-snmp-config --cflags`" break 2 fi done done } Same goes for ldlibs.sh and optprg.sh > Or is net-snmp-config a shell script (or similar) that delivers > correct paths when cross compiling? Im not that familiar with this cross compiling thing. I had the config script net-snmp-config tried in a cross-compiling environment and it did add extra path information. If all of it is correct, I cannot say. What I was told by the guy with the envir was that if the lib and script are installed in the cross-compiling envir, it would probably work. A suggestion from the guy with the envir was to build a dummy program including the lib and neglect build errors (if any) from that build. If it succeeds, build in snmp, otherwise skip it. I have not found anything that points to that netsnmp provide pkg-config files. Neither google nor search in lib has given me anything that point in that direction. Will you be able to try this cross compiling and see if it works with the updated version (I can send in a updated version if that is the case)? /Anders -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel