diff options
authorGravatar Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>2020-03-16 16:01:05 +0100
committerGravatar Peter Korsgaard <peter@korsgaard.com>2020-03-27 08:12:10 +0100
commit1182f73c1a7b60879ea1fb21c1b12b23da468807 (patch)
parentb06b0be65a5c2ff57c89c1f085d1f78919913920 (diff)
package/syslog-ng: fix build if net-snmp is installed on the host
If syslog-ng is selected in Buildroot and net-snmp is not, but net-snmp is found on the host machine (at least its net-snmp-config script) then compilation of syslog-ng fails with: CC modules/snmp-dest/modules_snmp_dest_libsnmpdest_la-snmpdest-grammar.lo CC modules/snmp-dest/modules_snmp_dest_libsnmpdest_la-snmpdest.lo CC modules/snmp-dest/modules_snmp_dest_libsnmpdest_la-snmpdest-plugin.lo arm-none-linux-gnueabi-gcc: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/include' make[3]: *** [Makefile:17397: modules/snmp-dest/modules_snmp_dest_libsnmpdest_la-snmpdest-grammar.lo] Error 1 make[3]: *** Waiting for unfinished jobs.... arm-none-linux-gnueabi-gcc: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/include' make[3]: *** [Makefile:17404: modules/snmp-dest/modules_snmp_dest_libsnmpdest_la-snmpdest.lo] Error 1 arm-none-linux-gnueabi-gcc: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/include' make[3]: *** [Makefile:17411: modules/snmp-dest/modules_snmp_dest_libsnmpdest_la-snmpdest-plugin.lo] Error 1 make[2]: *** [Makefile:21428: all-recursive] Error 1 make[1]: *** [Makefile:8740: all] Error 2 make[1]: Leaving directory '.../buildroot/output/build/syslog-ng-3.25.1' make: *** [package/pkg-generic.mk:269: .../buildroot/output/build/syslog-ng-3.25.1/.stamp_built] Error 2 The path /usr/include is obtained via /usr/bin/net-snmp-config. The fix comprises two parts: 1. only enable net-snmp support in syslog-ng if the net-snmp package is enabled in Buildroot 2. for the case where net-snmp is selected in Buildroot, fix the configure script of syslog-ng to allow parsing --with-netsnmp=<path> correctly. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Reviewed-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> (cherry picked from commit 4ff6e5239240a4e1bdf73c41d6e9bff9473ec62c) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2 files changed, 49 insertions, 0 deletions
diff --git a/package/syslog-ng/0002-configure.ac-fix-with-netsnmp.patch b/package/syslog-ng/0002-configure.ac-fix-with-netsnmp.patch
new file mode 100644
index 0000000000..f5b2a39bba
--- /dev/null
+++ b/package/syslog-ng/0002-configure.ac-fix-with-netsnmp.patch
@@ -0,0 +1,41 @@
+From 39ab118a7e79b223941b50b372c8ed51f0e21f4b Mon Sep 17 00:00:00 2001
+From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
+Date: Mon, 16 Mar 2020 15:41:03 +0100
+Subject: [PATCH] configure.ac: fix --with-netsnmp
+The option '--with-net-snmp' did not work, because later checks were using
+the variable '$with_netsnmp' rather than '$with_net_snmp'.
+There are two possible solutions:
+- make the option '--with-netsnmp'
+- change the internal variables
+Taking into account that latest upstream has moved away from autotools and
+towards cmake, we opt for the first option that has the least amount of
+Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
+Upstream-status: not applicable (latest upstream moved to cmake)
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+diff --git a/configure.ac b/configure.ac
+index bfc85c32d..392ab8bf3 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -148,8 +148,8 @@ AC_ARG_WITH(libnet,
+ ,
+ [with_libnet=""])
+- [ --with-net-snmp=path use path to net-snmp-config script],
++ [ --with-netsnmp=path use path to net-snmp-config script],
+ ,
+ [with_netsnmp=""])
diff --git a/package/syslog-ng/syslog-ng.mk b/package/syslog-ng/syslog-ng.mk
index fc44777d16..05a6141d4b 100644
--- a/package/syslog-ng/syslog-ng.mk
+++ b/package/syslog-ng/syslog-ng.mk
@@ -97,6 +97,14 @@ else
SYSLOG_NG_CONF_OPTS += --disable-systemd
+ifeq ($(BR2_PACKAGE_NETSNMP),y)
+SYSLOG_NG_CONF_OPTS += --enable-snmp-dest
+SYSLOG_NG_CONF_OPTS += --with-netsnmp="$(STAGING_DIR)/usr/bin"
+SYSLOG_NG_CONF_OPTS += --disable-snmp-dest
$(INSTALL) -m 0755 -D package/syslog-ng/S01syslog-ng \