fixes for net-snmp-5.6 when using m68k-uclinux-gcc

David Wu <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi - I had spent a few hours to check out the net-snmp-5.6 release and
tried to build using m68k-uclinux-gcc. (gcc 4.3.2)
I had some build errors and then fixed them. I am posting the makefile 
and fixes here, hoping it helpful to others.

The changes in hr_system.c might not be the best fix but it works for me.
The adding of "SUBDIRS="  avoids a recursive call to "make subdirs"
The vfork fix is for mmuless system
The configure fix is for the NETSNMP_SYSTEM_INCLUDE_FILE since "uclinux"
is  "linux"  in this case.

Someone may find the better fix than this.

The makefile:
=============
LIBS="-lpthread"

CONFOPTS = --host=m68k-uclinux \
     --target=m68k-uclinux \
     --enable-static \
     --with-endianness=big \
     --with-default-snmp-version=2 \
     --with-logfile="/var/log/snmpd.log" \
     --with-persistent-directory="/var/conf/net-snmp"

all: build/build
        (cd build ; make)

build/build: makefile
        rm -rf build
        mkdir build
        (cd build; LIBS="$(LIBS)" sh ../configure $(CONFIGURE_OPTS))
        touch build/build

clean:
        - rm -rf build

The following are the fixes I made.
============================
diff -urNa net-snmp-5.6/agent/helpers/Makefile.in
net-snmp-5.6-fix/agent/helpers/Makefile.in
--- net-snmp-5.6/agent/helpers/Makefile.in    2010-05-30
16:19:04.000000000 -0400
+++ net-snmp-5.6-fix/agent/helpers/Makefile.in    2010-10-28
18:38:19.454717089 -0400
@@ -18,7 +18,7 @@
 
 INSTALLLIBS=libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION)
 INCLUDESUBDIR=agent
-
+SUBDIRS=
 #
 # Build info
 #
diff -urNa net-snmp-5.6/agent/mibgroup/host/hr_system.c
net-snmp-5.6-fix/agent/mibgroup/host/hr_system.c
--- net-snmp-5.6/agent/mibgroup/host/hr_system.c    2008-10-21
17:10:43.000000000 -0400
+++ net-snmp-5.6-fix/agent/mibgroup/host/hr_system.c    2010-10-28
18:38:19.692716901 -0400
@@ -659,7 +659,7 @@
     return total;
 }
 
-#if defined(UTMP_FILE) && !HAVE_UTMPX_H
+#if !defined(UTMP_FILE) && !HAVE_UTMPX_H
 
 static FILE    *utmp_file;
 static struct utmp utmp_rec;
diff -urNa net-snmp-5.6/agent/mibgroup/Makefile.in
net-snmp-5.6-fix/agent/mibgroup/Makefile.in
--- net-snmp-5.6/agent/mibgroup/Makefile.in    2006-12-05
18:30:28.000000000 -0500
+++ net-snmp-5.6-fix/agent/mibgroup/Makefile.in    2010-10-28
18:38:19.470716873 -0400
@@ -29,6 +29,7 @@
 OBJS  = $(mib_module_list_o)
 LOBJS = $(mib_module_list_lo)
 SRCS  = $(mib_module_list_c)
+SUBDIRS=
 
 all: standardall $(LOBJS)
 
diff -urNa net-snmp-5.6/agent/mibgroup/utilities/execute.c
net-snmp-5.6-fix/agent/mibgroup/utilities/execute.c
--- net-snmp-5.6/agent/mibgroup/utilities/execute.c    2010-06-22
14:57:45.000000000 -0400
+++ net-snmp-5.6-fix/agent/mibgroup/utilities/execute.c    2010-10-28
18:38:19.831716694 -0400
@@ -188,8 +188,12 @@
     DEBUGMSGTL(("run:exec", "running '%s'\n", command));
     pipe(ipipe);
     pipe(opipe);
+#ifdef __uClinux__ /* HAVE uClinux */
+    if ((pid = vfork()) == 0) {
+#else
     if ((pid = fork()) == 0) {
-        /*
+#endif
+            /*
          * Child process
          */
 
diff -urNa net-snmp-5.6/apps/snmpnetstat/Makefile.in
net-snmp-5.6-fix/apps/snmpnetstat/Makefile.in
--- net-snmp-5.6/apps/snmpnetstat/Makefile.in    2007-05-14
17:48:53.000000000 -0400
+++ net-snmp-5.6-fix/apps/snmpnetstat/Makefile.in    2010-10-28
18:38:19.840716857 -0400
@@ -20,6 +20,7 @@
 OBJS=    inet.o inet6.o if.o main.o route.o winstub.o ffs.o
 LOBJS=    inet.lo inet6.lo if.lo main.lo route.lo winstub.lo ffs.lo
 TARG= snmpnetstat$(EXEEXT)
+SUBDIRS=
 
 CPPFLAGS= $(TOP_INCLUDES)  @CPPFLAGS@
 
diff -urNa net-snmp-5.6/apps/snmptrapd.c net-snmp-5.6-fix/apps/snmptrapd.c
--- net-snmp-5.6/apps/snmptrapd.c    2010-08-13 14:50:07.000000000 -0400
+++ net-snmp-5.6-fix/apps/snmptrapd.c    2010-10-28 18:38:19.845716801 -0400
@@ -1142,8 +1142,12 @@
     if (dofork && netsnmp_running) {
         int             fd;
 
-        switch (fork()) {
-        case -1:
+#ifdef __uClinux__ /* HAVE uClinux */
+        switch (vfork()) {
+#else
+    switch (fork()) {
+#endif
+    case -1:
             fprintf(stderr, "bad fork - %s\n", strerror(errno));
             _exit(1);
 
diff -urNa net-snmp-5.6/configure net-snmp-5.6-fix/configure
--- net-snmp-5.6/configure    2010-10-07 18:23:32.000000000 -0400
+++ net-snmp-5.6-fix/configure    2010-10-28 18:38:19.858716722 -0400
@@ -14989,6 +14989,9 @@
 $as_echo_n "checking for system include file... " >&6; }
 
 filebase=$target_os
+if test "x$target_os" = "xuclinux"; then
+    filebase=linux
+fi    
 # ignore binary format indication
 filebase=`echo $filebase | $SED 's/elf//'`
 filebase=`echo $filebase | $SED 's/aout//'`
diff -urNa net-snmp-5.6/local/Makefile.in net-snmp-5.6-fix/local/Makefile.in
--- net-snmp-5.6/local/Makefile.in    2010-04-21 18:31:46.000000000 -0400
+++ net-snmp-5.6-fix/local/Makefile.in    2010-10-28 18:45:43.544821150
-0400
@@ -10,6 +10,7 @@
 #
 OTHERINSTALL=localinstall
 OTHERUNINSTALL=localuninstall
+SUBDIRS=
 
 #
 # local info
diff -urNa net-snmp-5.6/man/Makefile.in net-snmp-5.6-fix/man/Makefile.in
--- net-snmp-5.6/man/Makefile.in    2010-08-16 06:16:55.000000000 -0400
+++ net-snmp-5.6-fix/man/Makefile.in    2010-10-28 18:45:43.545821049 -0400
@@ -67,7 +67,7 @@
     snmp_set_var_typed_value.3 snmp_set_var_value.3   \
     snmp_varlist_add_variable.3 snprint_value.3 snprint_variable.3
 PDU_ALIASES     = snmp_clone_pdu.3 snmp_fix_pdu.3 snmp_free_pdu.3
snmp_pdu_create.3
-
+SUBDIRS=
 
 
 MANALIASES=$(MIB_ALIASES) $(CONFIG_ALIASES) $(ALARM_ALIASES)
$(SESSION_ALIASES) \
diff -urNa net-snmp-5.6/mibs/Makefile.in net-snmp-5.6-fix/mibs/Makefile.in
--- net-snmp-5.6/mibs/Makefile.in    2010-03-31 11:34:24.000000000 -0400
+++ net-snmp-5.6-fix/mibs/Makefile.in    2010-10-28 18:45:43.545821049 -0400
@@ -11,6 +11,7 @@
 #
 OTHERINSTALL=mibsinstall
 OTHERUNINSTALL=mibsuninstall
+SUBDIRS=
 
 
 V1MIBS    = RFC1155-SMI.txt RFC1213-MIB.txt RFC-1215.txt
diff -urNa net-snmp-5.6/snmplib/Makefile.in
net-snmp-5.6-fix/snmplib/Makefile.in
--- net-snmp-5.6/snmplib/Makefile.in    2010-05-27 00:06:32.000000000 -0400
+++ net-snmp-5.6-fix/snmplib/Makefile.in    2010-10-28
18:45:43.547820951 -0400
@@ -132,6 +132,8 @@
     tools.h        \
     transform_oids.h
 
+SUBDIRS    =
+
 # libraries
 INSTALLLIBS=libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
 INSTALLUCDLIBS=libsnmp.$(LIB_EXTENSION)$(LIB_VERSION)


Regards,
David

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
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.