[dpdk-dev] [RFC PATCH] build: use libpcap only from pkg-config

Bruce Richardson bruce.richardson at intel.com
Thu Oct 8 19:08:05 CEST 2020


On Thu, Oct 08, 2020 at 06:05:36PM +0100, Bruce Richardson wrote:
> All recent linux distro's - including RHEL 8 and Ubuntu 18.04 - provide a
> pkg-config file for libpcap, and using other methods of finding the library
> can cause issues when cross-compiling, so we can limit build support for
> pcap versions without a .pc file.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
>  config/meson.build | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/config/meson.build b/config/meson.build
> index 69f2aeb60..edc6c195a 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -163,13 +163,7 @@ if libbsd.found()
>  endif
>  
>  # check for pcap
> -pcap_dep = dependency('pcap', required: false)
> -if pcap_dep.found()
> -	# pcap got a pkg-config file only in 1.9.0 and before that meson uses
> -	# an internal pcap-config finder, which is not compatible with
> -	# cross-compilation, so try to fallback to find_library
> -	pcap_dep = cc.find_library('pcap', required: false)
> -endif
> +pcap_dep = dependency('libpcap', required: false, method: 'pkg-config')
>  if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
>  	dpdk_conf.set('RTE_PORT_PCAP', 1)
>  	dpdk_extra_ldflags += '-lpcap'

Just sending this as an RFC for consideration, since I hit problems with
the pcap code when testing 32-bit (x32) builds, and remembered having hit
it previously too.

Does anyone see an issue with limiting our pcap detection to pkg-config
only in this case?

/Bruce


More information about the dev mailing list