netsnmp: fix libnl include path in configure script
PATCH 1/1 netsnmp: fix libnl include path in configure script
Search for libnl headers in staging directory, not in the host machine /usr/include/libnl3 folder.
--- package/netsnmp/netsnmp.mk | 7 +++++++ 1 file changed, 7 insertions(+)
package/netsnmp/netsnmp.mk +7 -0
@@ -93,6 +93,13 @@ else NETSNMP_CONF_OPTS += --disable-applications endif +define NETSNMP_FIX_LIBNL_INCLUDE_PATH + $(SED) "s,-I/usr/include/libnl3,-I$(STAGING_DIR)/usr/include/libnl3,g" \ + $(@D)/configure +endef + +NETSNMP_PRE_CONFIGURE_HOOKS += NETSNMP_FIX_LIBNL_INCLUDE_PATH + define NETSNMP_REMOVE_BLOAT_MIBS for mib in $(NETSNMP_BLOAT_MIBS); do \ rm -f $(TARGET_DIR)/usr/share/snmp/mibs/$$mib-MIB.txt; \
Signature · 1 line
2.1.0
PATCH 1/1 netsnmp: fix libnl include path in configure script
Hello,
Quoted 4 lines · Julien Floret
Search for libnl headers in staging directory, not in the host machine
/usr/include/libnl3folder.Signed-off-by Julien Floret <[email protected]>
Thanks for the patch. However, it's not the right way of fixing the issue, I'm afraid.
package/netsnmp/netsnmp.mk else · line 101
Quoted 6 lines
package/netsnmp/netsnmp.mk +6
-0+define NETSNMP_FIX_LIBNL_INCLUDE_PATH + $(SED) "s,-I/usr/include/libnl3,-I$(STAGING_DIR)/usr/include/libnl3,g" \ + $(@D)/configure +endef + +NETSNMP_PRE_CONFIGURE_HOOKS += NETSNMP_FIX_LIBNL_INCLUDE_PATH
The right fix is to modify configure.d/config_os_libs2 to avoid passing -I/usr/include/libnl3, and then autoreconf the package. To do this, you have a few options:
- Remove -I/usr/include/libnl3 entirely, and assume the user will pass the appropriate options in CPPFLAGS.
- Use -I=/usr/include/libnl3, gcc will automatically replace = by the compiler sysroot. However, I have no idea whether this also works with non-gcc compilers.
- Change the --with-nl option so that it takes a path to the nl library.
Also, if netsnmp optionally uses libnl, then it should optionally depend on it. Something like:
ifeq ($(BR2_PACKAGE_LIBNL),y)NETSNMP_DEPENDENCIES += libnlNETSNMP_CONF_OPTS += --with-nl
elseNETSNMP_CONF_OPTS += --without-nl
endif
Or, if you don't care about libnl support in netsnmp and don't want to spend time fixing the problem, just add --without-nl to netsnmp configuration options.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 netsnmp: fix libnl include path in configure script
Hello Thomas,
Quoted 7 lines
The right fix is to modify configure.d/config_os_libs2 to avoid passing -I/usr/include/libnl3, and then autoreconf the package. To do this, you have a few options:
- Remove -I/usr/include/libnl3 entirely, and assume the user will pass the appropriate options in CPPFLAGS.
Quoted 6 lines
- Use -I=/usr/include/libnl3, gcc will automatically replace = by the compiler sysroot. However, I have no idea whether this also works with non-gcc compilers.
- Change the --with-nl option so that it takes a path to the nl library.
Thanks for your analysis. Indeed, your proposals are much better than patching the configure script on the fly ;)
In fact, I just saw that the issue has been addressed upstream:
libnl include paths & libs can now be overriden with configure environment variables:
https://sourceforge.net/p/net-snmp/code/ci/852dcd644cfe4cfc7177649eaec163d6221f2be1/
So if you're ok with this, I suggest to:
- embed the upstream patch in package/netsnmp/
- trigger an autoreconf
- pass the right LIBNL3_{CFLAGS,LIBS} variables in NETSNMP_CONF_ENV.
Quoted 9 lines
Also, if netsnmp optionally uses libnl, then it should optionally depend on it. Something like:
ifeq ($(BR2_PACKAGE_LIBNL),y)
NETSNMP_DEPENDENCIES+= libnlNETSNMP_CONF_OPTS+= --with-nl
elseNETSNMP_CONF_OPTS+= --without-nl
endif
OK, I will add this as well.
Quoted 3 lines
Or, if you don't care about libnl support in netsnmp and don't want to spend time fixing the problem, just add --without-nl to netsnmp configuration options.
PATCH 1/1 netsnmp: fix libnl include path in configure script
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Julien" == Julien Floret <[email protected]> writes:
Hi,
Quoted 11 lines
Quoted 2 lines
- Change the --with-nl option so that it takes a path to the nl library.
Thanks for your analysis. Indeed, your proposals are much better than patching the configure script on the fly ;)
In fact, I just saw that the issue has been addressed upstream:
libnl include paths & libs can now be overriden with configure environment variables:
https://sourceforge.net/p/net-snmp/code/ci/852dcd644cfe4cfc7177649eaec163d6221f2be1/
Quoted 4 lines
So if you're ok with this, I suggest to:
- embed the upstream patch in package/netsnmp/
- trigger an autoreconf
- pass the right LIBNL3_{CFLAGS,LIBS} variables inNETSNMP_CONF_ENV.
Yes, sounds good, except that the last step shouldn't be needed as pkg-config (once you add host-pkgconf to NETSNMP_DEPENDENCIES) should return the correct values.
Thanks!
Signature · 1 line
Bye, Peter Korsgaard