Bug 196925 - net-mgmt/net-snmp fails to compile
Summary: net-mgmt/net-snmp fails to compile
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: Ryan Steinmetz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-20 09:50 UTC by Helge Oldach
Modified: 2015-01-23 07:07 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (zi)


Attachments
net-snmp-config.h (74.14 KB, text/x-csrc)
2015-01-20 13:56 UTC, Helge Oldach
no flags Details
config.log (zipped, otherwise too large) (58.25 KB, application/zip)
2015-01-20 13:57 UTC, Helge Oldach
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helge Oldach 2015-01-20 09:50:22 UTC
on a recent 9-STABLE:

...
libtool: link: ( cd ".libs" && rm -f "libnetsnmpmibs.la" && ln -s "../libnetsnmpmibs.la" "libnetsnmpmibs.la" )
: libnetsnmpmibs.la
/bin/sh ../libtool --mode=compile cc -I../include -I. -I../agent -I../agent/mibgroup  -I../snmplib -I/usr/include -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -O2 -pipe -I/usr/local/include -I/include -fno-strict-aliasing -Ufreebsd9 -Dfreebsd9=freebsd9 -c -o snmpd.lo snmpd.c
libtool: compile:  cc -I../include -I. -I../agent -I../agent/mibgroup -I../snmplib -I/usr/include -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -O2 -pipe -I/usr/local/include -I/include -fno-strict-aliasing -Ufreebsd9 -Dfreebsd9=freebsd9 -c snmpd.c  -fPIC -DPIC -o .libs/snmpd.o
libtool: compile:  cc -I../include -I. -I../agent -I../agent/mibgroup -I../snmplib -I/usr/include -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -O2 -pipe -I/usr/local/include -I/include -fno-strict-aliasing -Ufreebsd9 -Dfreebsd9=freebsd9 -c snmpd.c -o snmpd.o >/dev/null 2>&1
/bin/sh ../libtool --mode=link cc -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -O2 -pipe -I/usr/local/include -I/include -fno-strict-aliasing -Ufreebsd9 -Dfreebsd9=freebsd9 -o snmpd snmpd.lo -L/usr/lib -lm -lkvm -ldevstat -L/lib libnetsnmpagent.la libnetsnmpmibs.la ../snmplib/libnetsnmp.la -lelf -lssp_nonshared   -lpkg
libtool: link: cc -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -O2 -pipe -I/usr/local/include -I/include -fno-strict-aliasing -Ufreebsd9 -Dfreebsd9=freebsd9 -o .libs/snmpd .libs/snmpd.o  -L/usr/lib -L/lib ./.libs/libnetsnmpagent.so ./.libs/libnetsnmpmibs.so /usr/obj/usr/ports/net-mgmt/net-snmp/work/net-snmp-5.7.3/agent/.libs/libnetsnmpagent.so /usr/obj/usr/ports/net-mgmt/net-snmp/work/net-snmp-5.7.3/snmplib/.libs/libnetsnmp.so ../snmplib/.libs/libnetsnmp.so -lpkg -lwrap -lelf -lssp_nonshared -lm -lkvm -ldevstat -lcrypto  -Wl,-rpath -Wl,/usr/local/lib
/usr/bin/ld: cannot find -lpkg
*** [snmpd] Error code 1

Stop in /usr/obj/usr/ports/net-mgmt/net-snmp/work/net-snmp-5.7.3/agent.
*** [subdirs] Error code 1

Stop in /usr/obj/usr/ports/net-mgmt/net-snmp/work/net-snmp-5.7.3.
*** [do-build] Error code 1

Stop in /usr/ports/net-mgmt/net-snmp.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-20 09:50:22 UTC
Auto-assigned to maintainer zi@FreeBSD.org
Comment 2 Helge Oldach 2015-01-20 09:51:36 UTC
This happens since the recent update to 5.7.3.

I tried to revert this:

51c52
<               --with-ldflags="-lm -lkvm -ldevstat -L${PKG_PREFIX}/lib ${LCRYPTO}"
---
>               --with-ldflags="-lm -lkvm -ldevstat -lpkg -L${LOCALBASE}/lib -L${PKG_PREFIX}/lib ${LCRYPTO}"

but that just leads to another error. :-(
Comment 3 Ryan Steinmetz freebsd_committer freebsd_triage 2015-01-20 12:52:19 UTC
It appears as if you do not have ports-mgmt/pkg installed and have not yet converted your system to pkgng.

Can you confirm?
Comment 4 Helge Oldach 2015-01-20 13:03:41 UTC
no, and also the ports tree is up to date.

# pkg query %n-%v pkg
pkg-1.4.6
# ls -la /usr/local/lib/*pkg*
-rw-r--r--  1 root  wheel  1795440 Jan 19 06:01 /usr/local/lib/libpkg.a
lrwxr-xr-x  1 root  wheel       15 Jan 19 06:01 /usr/local/lib/libpkg.so -> libpkg.so.3.0.0
lrwxr-xr-x  1 root  wheel       15 Jan 19 06:01 /usr/local/lib/libpkg.so.3 -> libpkg.so.3.0.0
-rwxr-xr-x  1 root  wheel  1436472 Jan 19 06:01 /usr/local/lib/libpkg.so.3.0.0
# uname -v
FreeBSD 9.3-1376 #0: Thu Jan 15 09:47:53 CET 2015     toor@localhost:/usr/obj/usr/src/sys/HMO
#

I get the same behaviour on a bunch of different machines. All running STABLE-9 compiled on 15th January.

For the sake of testing, I had downgraded from 5.7.3 to 5.7.2 and can compile sucessfully. Note that 5.7.2 also asked for -lpkg and in facts links to it properly:

# ldd `which snmpwalk`
/usr/local/bin/snmpwalk:
        libnetsnmp.so.30 => /usr/local/lib/libnetsnmp.so.30 (0x28075000)
        libelf.so.1 => /usr/lib/libelf.so.1 (0x28133000)
        libm.so.5 => /lib/libm.so.5 (0x28154000)
        libkvm.so.5 => /lib/libkvm.so.5 (0x2816f000)
        libdevstat.so.7 => /lib/libdevstat.so.7 (0x28178000)
        libpkg.so.3 => /usr/local/lib/libpkg.so.3 (0x2817d000)
        libcrypto.so.6 => /lib/libcrypto.so.6 (0x282dd000)
        libc.so.7 => /lib/libc.so.7 (0x28440000)
        libfetch.so.6 => /usr/lib/libfetch.so.6 (0x28575000)
        libutil.so.9 => /lib/libutil.so.9 (0x28586000)
        libssl.so.6 => /usr/lib/libssl.so.6 (0x28599000)
        libjail.so.1 => /lib/libjail.so.1 (0x285e5000)
        libarchive.so.5 => /usr/lib/libarchive.so.5 (0x285ea000)
        libz.so.6 => /lib/libz.so.6 (0x28629000)
        libbz2.so.4 => /usr/lib/libbz2.so.4 (0x2863d000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x2864d000)
        libbsdxml.so.4 => /lib/libbsdxml.so.4 (0x28670000)
#
Comment 5 Ryan Steinmetz freebsd_committer freebsd_triage 2015-01-20 13:11:04 UTC
Please attach the config.log file from the build directory on one of the affected machines.  You can find it by:

$ cd /usr/ports/net-mgmt/net-snmp
$ make
...
$ cp  work/net-snmp-5.7.3/config.log /new/location

Please attach net-snmp-config.h as well.  You can find it under:

work/net-snmp-5.7.3/include/net-snmp/net-snmp-config.h
Comment 6 Helge Oldach 2015-01-20 13:19:20 UTC
I guess that's no longer necessary. Here is a fix:

--- Makefile.ctm        2015-01-19 21:21:31.000000000 +0100
+++ Makefile    2015-01-20 14:11:21.000000000 +0100
@@ -48,7 +48,7 @@
                --with-logfile="${NET_SNMP_LOGFILE}" \
                --with-persistent-directory="${NET_SNMP_PERSISTENTDIR}" \
                --with-gnu-ld --with-libwrap \
-               --with-ldflags="-lm -lkvm -ldevstat -L${PKG_PREFIX}/lib ${LCRYPTO}"
+               --with-ldflags="-lm -lkvm -ldevstat -L${LOCALBASE}/lib -L${PKG_PREFIX}/lib ${LCRYPTO}"
 SUB_FILES=     pkg-message

 .if defined(BATCH)


Should be fairly obvious what's missing. :-)

What is PKG_PREFIX, BTW?
Comment 7 Ryan Steinmetz freebsd_committer freebsd_triage 2015-01-20 13:33:15 UTC
It's still necessary.  That edit should no longer be required.  Please attach the files.
Comment 8 Helge Oldach 2015-01-20 13:56:26 UTC
Created attachment 151901 [details]
net-snmp-config.h
Comment 9 Helge Oldach 2015-01-20 13:57:33 UTC
Created attachment 151903 [details]
config.log (zipped, otherwise too large)
Comment 10 Helge Oldach 2015-01-20 13:58:29 UTC
attached.

Please explain the purpose of PKG_PREFIX...
Comment 11 Helge Oldach 2015-01-23 07:07:13 UTC
fixed with r377525: add -L$(LOCALBASE)/lib as propose by me