[collectd] SNMP plugin GCC issues on Solaris 10; workaround
Scott Severtson
ssevertson at digitalmeasures.com
Tue May 29 22:07:17 CEST 2012
All,
Another set of issues came up while compiling CollectD's SNMP plugin on
Solaris 10 x64 with GCC, when using Solaris' build-in net-snmp
libraries: net-snmp-config-(32|64) returns an invalid -R flag:
# /usr/sfw/bin/net-snmp-config-64 --libs
-R../lib/amd64 -xarch=amd64 -L/usr/sfw/lib/amd64 -lnetsnmp -lgen
-lpkcs11 -lkstat -lelf -lm -ldl -lnsl -lsocket -ladm
However, "-R" paths must be absolute. This appears to be a long-standing
known issue on the platform (at least since 2005):
http://comments.gmane.org/gmane.os.solaris.solarisx86/12708
A workaround would be to replace relative paths with /usr/sfw on
Solaris 10 (at least when the -config binary is under /usr/sfw/bin/).
Rather than mess with the autoconf scripts (not my favorite thing to
muck with), I created a wrapper bash script that fixes the --libs output:
/usr/sfw/bin/net-snmp-config-${BITS} "$@" | sed -e
's/-R..\//-R\/usr\/sfw\//'
A second SNMP issue comes up when compiling for 64 bits on Solaris 10
with GCC - both --cflags and --libs return a GCC-incompatible
architecture flag:
-R../lib/amd64 -xarch=amd64 -L/usr/sfw/lib/amd64 -lnetsnmp -lgen
-lpkcs11 -lkstat -lelf -lm -ldl -lnsl -lsocket -ladm
Again, the wrapper script/sed approach can be used for a workaround to
strip it out (as I'm already specifying "-march=athlon64" in my CFLAGS:
/usr/sfw/bin/net-snmp-config-${BITS} "$@" | sed -e 's/-xarch=[^ ]* //'
These workaround wrappers can be combined:
#!/bin/bash
/usr/sfw/bin/net-snmp-config-${BITS} "$@" | sed -e
's/-R..\//-R\/usr\/sfw\//' -e 's/-xarch=[^ ]* //'
However, of course it would be best to integrate fixes for these Solaris
10-specific issues in the autoconf scripts - anyone up to the task?
Thanks,
Scott Severtson
Chief Architect
Digital Measures
More information about the collectd
mailing list