Subject: pkg/33662: net/net-snmp build failures on MacOS X 10.3.9
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jdbaker@mylinuxisp.com>
List: pkgsrc-bugs
Date: 06/07/2006 14:55:00
>Number:         33662
>Category:       pkg
>Synopsis:       net/net-snmp build failures on MacOS X 10.3.9
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 07 14:55:00 +0000 2006
>Originator:     John D. Baker
>Release:        MacOS X 10.3.9, pkgsrc-current
>Organization:
>Environment:
Darwin bondi.local 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC  Power Macintosh powerpc

>Description:
Building net/net-snmp on MacOS X 10.3.9 fails as follows:

First:

[...]
 gcc -pipe -I../include -I. -I../agent -I../agent/helpers -I../agent/mibgroup -I../snmplib -no-cpp-precomp -I/Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/.buildlink/include -O2 -Ddarwin7 -c snmptrapd_auth.c  -fno-common -DPIC -o .libs/snmptrapd_auth.o
In file included from snmptrapd_auth.c:10:
/usr/include/netinet/in.h:255: error: parse error before "in_addr_t"
/usr/include/netinet/in.h:312: error: parse error before "u_char"
/usr/include/netinet/in.h:314: error: parse error before "sin_port"
/usr/include/netinet/in.h:317: error: parse error before '}' token
/usr/include/netinet/in.h:329: error: field `ip_dst' has incomplete type
/usr/include/netinet/in.h:398: error: field `imr_multiaddr' has incomplete type
/usr/include/netinet/in.h:399: error: field `imr_interface' has incomplete type
In file included from /usr/include/netinet/in.h:518,
                 from snmptrapd_auth.c:10:
/usr/include/netinet6/in6.h:625: error: parse error before "inet6_rthdr_space"
/usr/include/netinet6/in6.h:637: error: parse error before "size_t"
/usr/include/netinet6/in6.h:639: error: parse error before "size_t"
/usr/include/netinet6/in6.h:640: error: parse error before "size_t"
/usr/include/netinet6/in6.h:641: error: parse error before "size_t"
/usr/include/netinet6/in6.h:644: error: parse error before "size_t"
/usr/include/netinet6/in6.h:646: error: parse error before "size_t"
/usr/include/netinet6/in6.h:647: error: parse error before "size_t"
/usr/include/netinet6/in6.h:648: error: parse error before "inet6_rth_space"
/usr/include/netinet/in.h:315: error: storage size of `sin_addr' isn't known
*** Error code 1

Stop.
bmake: stopped in /Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/net-snmp-5.3.0.1/apps
[...]


After applying the first patch below, the build proceeds up until
the following:

[...]
 gcc -pipe -I../include -I. -I../agent -I../agent/helpers -I../agent/mibgroup -I../snmplib -no-cpp-precomp -I/Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/.buildlink/include -O2 -Ddarwin7 -c snmptrapd.c -o snmptrapd.o >/dev/null 2>&1
/bin/sh ../libtool --mode=link gcc -pipe -o snmptrapd snmptrapd.lo libnetsnmptrapd.la -L../snmplib -L../agent -L../agent/helpers -L/usr/pkg/lib -L/usr/lib ../agent/libnetsnmpagent.la ../agent/libnetsnmpmibs.la ../agent/helpers/libnetsnmphelpers.la ../snmplib/libnetsnmp.la -ldl -lkvm -lz -lcrypto -lm -L/usr/lib/lib -lwrap 
gcc -pipe -o .libs/snmptrapd .libs/snmptrapd.o  ./.libs/libnetsnmptrapd.dylib -L/Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/.buildlink/lib -L/Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/net-snmp-5.3.0.1/snmplib -L/Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/net-snmp-5.3.0.1/agent -L/Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/net-snmp-5.3.0.1/agent/helpers ../agent/.libs/libnetsnmpagent.dylib ../agent/.libs/libnetsnmpmibs.dylib ../agent/helpers/.libs/libnetsnmphelpers.dylib ../snmplib/.libs/libnetsnmp.dylib -ldl -lkvm -lz -lcrypto -lm -L/usr/lib/lib -lwrap 
ld: warning -L: directory name (/usr/lib/lib) does not exist
ld: Undefined symbols:
_init_vacm_config_tokens
_vacm_check_view
*** Error code 1

Stop.
bmake: stopped in /Volumes/NetBSD/tmp/pkgsrc/net/net-snmp/work/net-snmp-5.3.0.1/apps
[...]

>How-To-Repeat:
On MacOS X 10.3.9, attempt to build net/net-snmp
>Fix:
The first problem is solved by the following patch:

--- work/net-snmp-5.3.0.1/apps/snmptrapd_auth.c.orig    Wed Jun  7 08:09:25 2006
+++ work/net-snmp-5.3.0.1/apps/snmptrapd_auth.c Wed Jun  7 08:09:46 2006
@@ -7,6 +7,7 @@
 #if HAVE_WINSOCK_H
 #include <winsock.h>
 #else
+#include <sys/types.h>
 #include <netinet/in.h>
 #include <netdb.h>
 #endif

I expect this to be sufficiently benign that it could be applied
universally?


The second problem I don't know about.  The curious bit is
"-L/usr/lib/lib"  I don't know where that comes from.  Perhaps
there is an incomplete edit someplace and "-L/usr/pkg/lib" is
what was intended?

A search for the string in relevant files returns:

find . -type f -exec grep -e "-L[ ]*/usr/lib/lib" {} \; -print
OUR_AGENT_LIBS  = $(INSTALLLIBS) $(HELPERLIB) -L/usr/lib/lib -lwrap $(LIBS) 
./agent/Makefile
TRAPLIBS        = $(TRAPDWITHAGENT) -L/usr/lib/lib -lwrap $(PERLLDOPTS)
./apps/Makefile
configure:15740: gcc -pipe -o conftest -O2 -I/usr/pkg/include -I/usr/include -Ddarwin7 -no-cpp-precomp -I/usr/pkg/include -I/usr/include -I/usr/lib/include -L/usr/pkg/lib -L/usr/lib -L/usr/lib/lib conftest.c -lcrypto -lm  -lwrap >&5
WRAPLIBS='-L/usr/lib/lib -lwrap'
./config.log
s,@WRAPLIBS@,-L/usr/lib/lib -lwrap,;t t
./config.status
NSC_AGENTLIBS="-ldl -lkvm -lz -lcrypto -lm  -L/usr/lib/lib -lwrap "
./net-snmp-config