As part of getting OpenSSL from ports and base to play well with one another, I moved OpenSSL from ports to /usr/local/lib/openssl . This has exposed the fact that LDFLAGS from USES+=ssl isn't honored/passed through to configure properly. Moreover, the port uses PKG_PREFIX, a non-existent variable, instead of PREFIX or LOCALBASE. ``` $ (cd ../freebsd-ports/net-mgmt/net-snmp; make -VPKG_PREFIX) $ ``` The patch below addresses both of those issues: ``` diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile index 0af9bccd05ee..e2e91ff73eac 100644 --- a/net-mgmt/net-snmp/Makefile +++ b/net-mgmt/net-snmp/Makefile @@ -50,7 +50,7 @@ CPE_PRODUCT= net-snmp USE_PERL5= build run USE_CSTD= c99 -CFLAGS+= -I${LOCALBASE}/include -I${PKG_PREFIX}/include +CFLAGS+= -I${LOCALBASE}/include -I${PREFIX}/include LDFLAGS+= -L${LOCALBASE}/lib CONFIGURE_ENV+= PERLPROG="${PERL}" PSPROG="${PS_CMD}" SED="${SED}" CONFIGURE_ARGS+=--enable-shared --enable-internal-md5 \ @@ -60,7 +60,7 @@ CONFIGURE_ARGS+=--enable-shared --enable-internal-md5 \ --with-logfile="${NET_SNMP_LOGFILE}" \ --with-persistent-directory="${NET_SNMP_PERSISTENTDIR}" \ --with-gnu-ld --without-libwrap \ - --with-ldflags="-lm -lkvm -ldevstat -L${PKG_PREFIX}/lib -L${LOCALBASE}/lib ${LCRYPTO}" + --with-ldflags="-lm -lkvm -ldevstat -L${PREFIX}/lib ${LDFLAGS}" SUB_FILES= pkg-message .if !defined(WITHOUT_SSP) ```
Oh, interesting... those libraries shouldn't be defined there to begin with either.
FWIW though... they really shouldn't be defined on the command-line using LIBS or --with-libs -- that would cause a boatload of overlinking with programs that shouldn't be done to begin with. autoconf should be adjusted to detect and pass through the libraries instead.
Here's a complete patch from my gist (test in progress): https://gist.github.com/ngie-eign/a7be390d21989e343bc4979cfe6f6c07 .