[dpdk-dev,v2,2/3] build: fix check for libbsd in meson

Message ID 20180427134928.4716-3-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson April 27, 2018, 1:49 p.m. UTC
  When we check for libbsd we were just checking for the library itself.
However, on some distros, e.g. CentOS, libbsd will be found even though
it's not usable by DPDK as it's missing the string header. Therefore we
should check for both the library and the header file.

Fixes: 5364de644a4b ("eal: support strlcpy function")

Signed-off-by: Bruce Richarson <bruce.richardson@intel.com>
---
 config/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson April 27, 2018, 1:51 p.m. UTC | #1
On Fri, Apr 27, 2018 at 02:49:27PM +0100, Bruce Richardson wrote:
> When we check for libbsd we were just checking for the library itself.
> However, on some distros, e.g. CentOS, libbsd will be found even though
> it's not usable by DPDK as it's missing the string header. Therefore we
> should check for both the library and the header file.
> 
> Fixes: 5364de644a4b ("eal: support strlcpy function")
> 

Sorry, forgot to add:

Reported-by: Vladimir Medvedkin <medvedkinv@gmail.com>

> Signed-off-by: Bruce Richarson <bruce.richardson@intel.com>
> ---
>  config/meson.build | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/config/meson.build b/config/meson.build
> index 5815b5602..2179c689c 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -43,7 +43,8 @@ if numa_dep.found() and cc.has_header('numaif.h')
>  endif
>  
>  # check for strlcpy
> -if host_machine.system() == 'linux' and cc.find_library('bsd', required: false).found()
> +if host_machine.system() == 'linux' and cc.find_library('bsd',
> +		required: false).found() and cc.has_header('bsd/string.h')
>  	dpdk_conf.set('RTE_USE_LIBBSD', 1)
>  	add_project_link_arguments('-lbsd', language: 'c')
>  	dpdk_extra_ldflags += '-lbsd'
> -- 
> 2.14.3
>
  
Vladimir Medvedkin April 27, 2018, 5:51 p.m. UTC | #2
Hi,

2018-04-27 16:51 GMT+03:00 Bruce Richardson <bruce.richardson@intel.com>:

> On Fri, Apr 27, 2018 at 02:49:27PM +0100, Bruce Richardson wrote:
> > When we check for libbsd we were just checking for the library itself.
> > However, on some distros, e.g. CentOS, libbsd will be found even though
> > it's not usable by DPDK as it's missing the string header. Therefore we
> > should check for both the library and the header file.
> >
> > Fixes: 5364de644a4b ("eal: support strlcpy function")
> >
>
> Sorry, forgot to add:
>
> Reported-by: Vladimir Medvedkin <medvedkinv@gmail.com>
>
> > Signed-off-by: Bruce Richarson <bruce.richardson@intel.com>
> > ---
> >  config/meson.build | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/config/meson.build b/config/meson.build
> > index 5815b5602..2179c689c 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -43,7 +43,8 @@ if numa_dep.found() and cc.has_header('numaif.h')
> >  endif
> >
> >  # check for strlcpy
> > -if host_machine.system() == 'linux' and cc.find_library('bsd',
> required: false).found()
> > +if host_machine.system() == 'linux' and cc.find_library('bsd',
> > +             required: false).found() and cc.has_header('bsd/string.h')
> >       dpdk_conf.set('RTE_USE_LIBBSD', 1)
> >       add_project_link_arguments('-lbsd', language: 'c')
> >       dpdk_extra_ldflags += '-lbsd'
> > --
> > 2.14.3
> >
>

Acked-by: Vladimir Medvedkin <medvedkinv@gmail.com>
  

Patch

diff --git a/config/meson.build b/config/meson.build
index 5815b5602..2179c689c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -43,7 +43,8 @@  if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd', required: false).found()
+if host_machine.system() == 'linux' and cc.find_library('bsd',
+		required: false).found() and cc.has_header('bsd/string.h')
 	dpdk_conf.set('RTE_USE_LIBBSD', 1)
 	add_project_link_arguments('-lbsd', language: 'c')
 	dpdk_extra_ldflags += '-lbsd'