RE: Compile net-snmp 5.7.2 on Solaris 10

"Taylor, Ben" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <289654F203D46542A3013F8A4EFF3E9B466044BD@USPHLEMB12C.global.corp.sap>
I have a script that I use at work, but I need to cleanse that.  However, here are all the tricks I know:

You will want to gnu make  for the build.   You'll need to add /usr/sfw/bin to the path to get the ssl libraries/includes (or some other path prior to that if you use sunfreeware or your own built ssl libs)

You'll need to add 

LDFLAGS="-z interpose /usr/lib/[email protected]"

To the environment when you configure, since it appear many more linux fixes have gone into, and this allows Solaris to not core on dealing with NULL strings.

Ie:   env LDFLAGS="-z interpose /usr/lib/[email protected]" ./configure .....

Finally, I munge up all the Makefiles after the configure with something like (This is if you're using the sfw ssl, and not a home built or sunfreeware ssl library):

find . -name Makefile -exec /usr/local/bin/sed -i -e 's,-L/usr/sfw/lib,-L/usr/sfw/lib -R/usr/sfw/lib,g' {} \;

so that the linker will add to the RUNPATH the ssl libs so you don't have to wrap snmpd with a shell script to set LD_LIBRARY_PATH, or munge it up with the link editor.

Here's a patch that I used to fix the procinfo on Solaris.

/usr/local/bin/diff -ruN net-snmp-5.7.2-ORIG/agent/mibgroup/host/data_access/swrun_procfs_psinfo.c net-snmp-5.7.2/agent/mibgroup/host/data_access/swrun_procfs_psinfo.c
--- net-snmp-5.7.2-ORIG/agent/mibgroup/host/data_access/swrun_procfs_psinfo.c   2013-11-13 19:00:16.000000000 +0000
+++ net-snmp-5.7.2/agent/mibgroup/host/data_access/swrun_procfs_psinfo.c        2013-11-19 07:06:35.102560093 +0000
@@ -58,6 +58,7 @@
     psinfo_t             psinfo;
     int                  pid, rc, fd;
     char                *cp, buf[512];
+    const char          *sep = " \t";
     netsnmp_swrun_entry *entry;

     procdir = opendir("/proc");
@@ -90,26 +91,25 @@
         close(fd);

         entry->hrSWRunName_len
-            = sprintf(entry->hrSWRunName, "%.*s",
-                      (int)sizeof(entry->hrSWRunName) - 1,
+            = snprintf(entry->hrSWRunName,
+                      (int)sizeof(entry->hrSWRunName) - 1, "%s",
                       psinfo.pr_fname);
         /*
          *  Split pr_psargs into two:
          *     argv[0]   is hrSWRunPath
          *     argv[1..] is hrSWRunParameters
          */
-        for ( cp = psinfo.pr_psargs; ' ' == *cp; cp++ )
-            ;
-        *cp = '\0';    /* End of argv[0] */
-        entry->hrSWRunPath_len
-            = sprintf(entry->hrSWRunPath, "%.*s",
-                      (int)sizeof(entry->hrSWRunPath) - 1,
-                      psinfo.pr_psargs);
-
-        entry->hrSWRunParameters_len
-            = sprintf(entry->hrSWRunParameters, "%.*s",
-                      (int)sizeof(entry->hrSWRunParameters) - 1, cp+1);
-        *cp = ' ';     /* Restore pr_psargs value */
+       strcpy(buf, psinfo.pr_psargs);
+       cp = strtok(buf, sep);
+        if (cp) {
+            entry->hrSWRunPath_len
+                = snprintf(entry->hrSWRunPath,(int)sizeof(entry->hrSWRunPath) - 1, "%s", cp);
+            entry->hrSWRunParameters_len
+                = snprintf(entry->hrSWRunParameters,(int)sizeof(entry->hrSWRunParameters) - 1, "%s", strchr(psinfo.pr_psargs,' ')+1);
+        } else {
+            entry->hrSWRunPath_len
+                = snprintf(entry->hrSWRunPath,(int)sizeof(entry->hrSWRunPath) - 1, "%s", psinfo.pr_psargs);
+        }

         /*
          * check for system processes

Ben

-----Original Message-----
From: Indian Warrior [mailto:[email protected]] 
Sent: Wednesday, December 11, 2013 11:54 AM
To: [email protected]
Subject: Compile net-snmp 5.7.2 on Solaris 10

Hello ,
Can you please provide the procedure to compile net-snmp 5.7.2 on Solaris 10 ?

Thanks
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.