[meta-networking,1/1] net-snmp: Fix host contamination

Submitted by Ovidiu Panait on June 15, 2018, 8:22 a.m. | Patch ID: 151740

Details

Message ID 1529050946-24921-1-git-send-email-ovidiu.panait@windriver.com
State Changes Requested
Headers show

Commit Message

Ovidiu Panait June 15, 2018, 8:22 a.m.
If "/usr/local/ssl/include" directory exists on the host machine, net-snmp will
also search the host openssl headers:

build/net-snmp/temp$ grep -i "/usr/local/ssl/include" log.do_compile
x86_64-wrs-linux-libtool: compile: x86_64-wrs-linux-gcc ... -I/usr/local/ssl/include

Fix this by selecting the proper sysroot headers using
--with-openssl=${STAGING_EXECPREFIXDIR}

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
 meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
index 5c827bb86..6f6f19ac9 100644
--- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
@@ -66,7 +66,8 @@  EXTRA_OECONF = "--enable-shared \
                 --with-install-prefix=${D} \
                 --with-persistent-directory=${localstatedir}/lib/net-snmp \
                 ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)} \
-"
+                --with-openssl=${STAGING_EXECPREFIXDIR} \
+                "
 
 # net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp
 EXTRA_OECONF += "--with-mib-modules=smux"
@@ -121,8 +122,10 @@  do_install_append() {
     install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system
     install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
     sed    -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
+           -e "s@${STAGING_DIR_TARGET}@@g" \
         -i ${D}${bindir}/net-snmp-create-v3-user
     sed    -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
+           -e "s@${STAGING_DIR_TARGET}@@g" \
            -e "s@\([^ ]*-fdebug-prefix-map=[^ ]*\)\1*@@g" \
            -e "s@\([^ ]*--sysroot=[^ ]*\)\1*@@g" \
            -e "s@\([^ ]*--with-libtool-sysroot=[^ ]*\)\1*@@g" \

Comments

Khem Raj June 16, 2018, 3:43 p.m.
Hi Ovidiu

On 6/15/18 1:22 AM, Ovidiu Panait wrote:
> If "/usr/local/ssl/include" directory exists on the host machine, net-snmp will
> also search the host openssl headers:
> 
> build/net-snmp/temp$ grep -i "/usr/local/ssl/include" log.do_compile
> x86_64-wrs-linux-libtool: compile: x86_64-wrs-linux-gcc ... -I/usr/local/ssl/include
> 
> Fix this by selecting the proper sysroot headers using
> --with-openssl=${STAGING_EXECPREFIXDIR}
> 
> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
> ---
>   meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
> index 5c827bb86..6f6f19ac9 100644
> --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
> +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb
> @@ -66,7 +66,8 @@ EXTRA_OECONF = "--enable-shared \
>                   --with-install-prefix=${D} \
>                   --with-persistent-directory=${localstatedir}/lib/net-snmp \
>                   ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)} \
> -"
> +                --with-openssl=${STAGING_EXECPREFIXDIR} \
> +                "
>   
>   # net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp
>   EXTRA_OECONF += "--with-mib-modules=smux"
> @@ -121,8 +122,10 @@ do_install_append() {
>       install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system
>       install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
>       sed    -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
> +           -e "s@${STAGING_DIR_TARGET}@@g" \

this change here and similar change below is causing build failures 
since we are removing tags which are used to replace target sysroot 
especially for crossscripts which exposes the host paths e.g. -L/usr/lib 
into net-snmp-config files. This shows up later in dependent packages 
which fail to detect net-snmp features due to this host contamination 
e.g corosync, ntop, keepalived this is worse on x86_64 where it might 
still work but for musl targets you get straight errors everywhere.

If you can explain what these changes are fixing. May be we can come up 
with alternatives which dont cause the above said regression. Please 
rework through this patch

>           -i ${D}${bindir}/net-snmp-create-v3-user
>       sed    -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
> +           -e "s@${STAGING_DIR_TARGET}@@g" \
>              -e "s@\([^ ]*-fdebug-prefix-map=[^ ]*\)\1*@@g" \
>              -e "s@\([^ ]*--sysroot=[^ ]*\)\1*@@g" \
>              -e "s@\([^ ]*--with-libtool-sysroot=[^ ]*\)\1*@@g" \
>