diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile index f11d7a4f633..56d94914c37 100644 --- a/net/net-snmp/Makefile +++ b/net/net-snmp/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.115 2020/09/04 19:46:15 sthen Exp $ +# $OpenBSD: Makefile,v 1.116 2020/09/07 10:18:14 sthen Exp $ COMMENT-main= extendable SNMP implementation COMMENT-tkmib= graphical SNMP MIB browser @@ -50,10 +50,7 @@ DEFAULT_MIBS= IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB # - base OpenBSD mibs (/usr/share/snmp/mibs), SNMPD-CONF pulls in the rest OPENBSD_MIBS= OPENBSD-SNMPD-CONF -#CONFIGURE_STYLE= gnu -CONFIGURE_STYLE= autoreconf -AUTOMAKE_VERSION= 1.16 -AUTOCONF_VERSION= 2.69 +CONFIGURE_STYLE= gnu CONFIGURE_ARGS= --enable-ipv6 \ --enable-blumenthal-aes \ --enable-mfd-rewrites \ diff --git a/net/net-snmp/patches/patch-configure b/net/net-snmp/patches/patch-configure new file mode 100644 index 00000000000..cad0401c69b --- /dev/null +++ b/net/net-snmp/patches/patch-configure @@ -0,0 +1,61 @@ +$OpenBSD: patch-configure,v 1.12 2020/09/07 10:18:14 sthen Exp $ + +From ee7c66cf856dcda14f6d1d1503b80c0535509bc3 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Fri, 4 Sep 2020 13:32:54 -0700 +Subject: [PATCH] OpenBSD: Do not use the linker flag -no-undefined + +Index: configure +--- configure.orig ++++ configure +@@ -17011,15 +17011,22 @@ esac + + + # +-# Whether the linker supports the flag -Wl,-no-undefined. ++# Whether the linker supports the flag -Wl,-no-undefined. Do not use ++# -Wl,-no-undefined on OpenBSD because it breaks linking of shared ++# libraries. Use -Wl,-no-undefined on all other platforms such that ++# undefined symbols are detected at compile time instead of at runtime. + # + +-if ! echo "$CFLAGS" | grep -q -- -fsanitize=; then +-saved_LDFLAGS=$LDFLAGS +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker supports -Wl,-no-undefined" >&5 ++case x$target_os in ++ xopenbsd*) ++ ;; ++ *) ++ if ! echo "$CFLAGS" | grep -q -- -fsanitize=; then ++ saved_LDFLAGS=$LDFLAGS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker supports -Wl,-no-undefined" >&5 + $as_echo_n "checking whether the linker supports -Wl,-no-undefined... " >&6; } +-LDFLAGS="$saved_LDFLAGS -Wl,-no-undefined" +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ LDFLAGS="$saved_LDFLAGS -Wl,-no-undefined" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + + int +@@ -17032,16 +17039,18 @@ main () + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; }; LD_NO_UNDEFINED=-Wl,-no-undefined ++$as_echo "yes" >&6; }; LD_NO_UNDEFINED=-Wl,-no-undefined + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + $as_echo "no" >&6; } + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +-LDFLAGS="$saved_LDFLAGS" ++ LDFLAGS="$saved_LDFLAGS" + +-fi ++ fi ++ ;; ++esac + + + # diff --git a/net/net-snmp/patches/patch-configure_d_config_os_progs b/net/net-snmp/patches/patch-configure_d_config_os_progs index c66651e3a6e..42fae70b0b6 100644 --- a/net/net-snmp/patches/patch-configure_d_config_os_progs +++ b/net/net-snmp/patches/patch-configure_d_config_os_progs @@ -1,30 +1,24 @@ -$OpenBSD: patch-configure_d_config_os_progs,v 1.6 2020/09/04 20:06:11 sthen Exp $ +$OpenBSD: patch-configure_d_config_os_progs,v 1.7 2020/09/07 10:18:14 sthen Exp $ -Net-SNMP tries to use -Wl,-no-undefined to detect missing linkage at build -time (rather than dying at runtime if referenced functions are unavailable - -this happened with some AES-related functions in an earlier release where -libm wasn't linked to the library correctly). - -When trying to link the shared libraries, this fails on OpenBSD with missing -libc-related symbols. I think this maybe because OpenBSD doesn't record -libc as needed in shared libraries, presumably as a result of this --no-undefined is tripped. - -Neuter the autoconf check here to avoid this problem. - -https://github.com/net-snmp/net-snmp/issues/178 +From ee7c66cf856dcda14f6d1d1503b80c0535509bc3 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Fri, 4 Sep 2020 13:32:54 -0700 +Subject: [PATCH] OpenBSD: Do not use the linker flag -no-undefined Index: configure.d/config_os_progs --- configure.d/config_os_progs.orig +++ configure.d/config_os_progs -@@ -207,21 +207,7 @@ case x$target_os in - esac +@@ -208,20 +208,29 @@ esac --# + # -# Whether the linker supports the flag -Wl,-no-undefined. --# -- ++# Whether the linker supports the flag -Wl,-no-undefined. Do not use ++# -Wl,-no-undefined on OpenBSD because it breaks linking of shared ++# libraries. Use -Wl,-no-undefined on all other platforms such that ++# undefined symbols are detected at compile time instead of at runtime. + # + -if ! echo "$CFLAGS" | grep -q -- -fsanitize=; then -saved_LDFLAGS=$LDFLAGS -AC_MSG_CHECKING([whether the linker supports -Wl,-no-undefined]) @@ -34,8 +28,25 @@ Index: configure.d/config_os_progs - LD_NO_UNDEFINED=-Wl,-no-undefined], - [AC_MSG_RESULT([no])]) -LDFLAGS="$saved_LDFLAGS" - AC_SUBST(LD_NO_UNDEFINED) +-AC_SUBST(LD_NO_UNDEFINED) -fi ++case x$target_os in ++ xopenbsd*) ++ ;; ++ *) ++ if ! echo "$CFLAGS" | grep -q -- -fsanitize=; then ++ saved_LDFLAGS=$LDFLAGS ++ AC_MSG_CHECKING([whether the linker supports -Wl,-no-undefined]) ++ LDFLAGS="$saved_LDFLAGS -Wl,-no-undefined" ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], ++ [AC_MSG_RESULT([yes]); dnl ++ LD_NO_UNDEFINED=-Wl,-no-undefined], ++ [AC_MSG_RESULT([no])]) ++ LDFLAGS="$saved_LDFLAGS" ++ AC_SUBST(LD_NO_UNDEFINED) ++ fi ++ ;; ++esac #