From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 893A42BF5 for ; Tue, 26 Feb 2019 18:47:02 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id i12so14973321wrw.0 for ; Tue, 26 Feb 2019 09:47:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M3bfXYkriF6V+9Eq5VxG7MBFN7RXgaCA0a7LvsOSQZo=; b=E14gI+8zCKj7LUr/XTTPVuBnUS1tU7GsudboDs6wobj8S0hb+eUzdYBvdjsACoA+ZQ M+lmkkQv0pBYkZIhMi+Uplc90GMKU/SFopwryqtjS6IirAl9NTTqEtCYLCrWK6HMxwMA y7RZ5lKugwQMvCT8ihNHcagXe0o+r1NXmJ5jCKumcevno2weRoPZYBlulATSrTb+yuy1 BQ8TedF25ab4sr9ByFMumzXmqs2bFte8IS1ndO2hngkH5QQhvFN9wNEAU8Qg2rUXi/ZR xXfAEPOOsI5/7tQsDImbXuRTxGIJ98AeHx85GD13vj1YomSH35tWbzXbyCmcUwjHgAGc r4+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M3bfXYkriF6V+9Eq5VxG7MBFN7RXgaCA0a7LvsOSQZo=; b=o8R6ExqMFubpYwXAU1PRp68koHUqXoFCEtDS/g1awKXPZ0oMMzvc+hTvL1zdlgXOr2 oonuB+TjHW+kHhuN5sYD4JYXqLKw4NLd5im0OrExSZ++2RhZdluud0SHEIlMsunP/aE7 2zkGHy/jhf1cGxGWRqrER4S5ljBUFTTBy+vICWaiTJnzJ2B+8jaBupvOxb6iv5endxLy jvl29g0XCFc6wzYlCyvazfHHYs1c2h18XY1ZKQJ4MgBcrHhzuUURAow2ybGp4wMQ+FEs +GzlbGsyzlNDtAhhCRsuSqLBYr51JFGzZjqvAI2Cx2d4Ic7N2qNooDhL3v5O/d2oFk4O CziA== X-Gm-Message-State: AHQUAuZqotmbR9Ew7xbjTAVKXtcy5YBir+1PcXLkZVx9Lgd9Hdnw8qGn dy1LLJbIeddlqAgoz3R87cPZnsuga0c= X-Google-Smtp-Source: AHgI3IYJ1AFxUMsaribnnirGpHdMR75VwyLOEmM+byWqx0PnB2BbkzZawBy1yyca007F+GofC4/RSw== X-Received: by 2002:adf:eac2:: with SMTP id o2mr17029015wrn.0.1551203221829; Tue, 26 Feb 2019 09:47:01 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:b00c:66c8:99df:336]) by smtp.gmail.com with ESMTPSA id p1sm83911wmi.9.2019.02.26.09.47.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 09:47:01 -0800 (PST) From: luca.boccassi@gmail.com To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net Date: Tue, 26 Feb 2019 17:46:37 +0000 Message-Id: <20190226174637.27452-6-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226174637.27452-1-luca.boccassi@gmail.com> References: <20190103175725.5836-1-bluca@debian.org> <20190226174637.27452-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v8 6/6] build: use dependency for pcap and fallback to find_library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2019 17:47:02 -0000 From: Luca Boccassi pcap has historically shipped a custom pcap-config binary tool which does the job of pkg-config. It was never compatible with cross compilation. Meson uses it when using dependency(), which then means cross compilation fails. Set pcap-config to empty in the meson cross compilation files so that Meson will not use it, and add a fallback in case dependency() fails. libpcap 1.9.0 finally ships a pkg-config file so everything will work out of the box in the future. Signed-off-by: Luca Boccassi --- v8: added back pcap change separately. Tested with bootlin cross-compilation toolchain, everything seems to work. config/arm/arm64_armv8_linuxapp_gcc | 1 + config/arm/arm64_dpaa2_linuxapp_gcc | 1 + config/arm/arm64_dpaa_linuxapp_gcc | 1 + config/arm/arm64_thunderx_linuxapp_gcc | 1 + drivers/net/pcap/meson.build | 16 ++++++++++++---- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config/arm/arm64_armv8_linuxapp_gcc b/config/arm/arm64_armv8_linuxapp_gcc index 987c02fbb..513760917 100644 --- a/config/arm/arm64_armv8_linuxapp_gcc +++ b/config/arm/arm64_armv8_linuxapp_gcc @@ -3,6 +3,7 @@ c = 'aarch64-linux-gnu-gcc' cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-gcc-ar' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/config/arm/arm64_dpaa2_linuxapp_gcc b/config/arm/arm64_dpaa2_linuxapp_gcc index 7ec74ec4b..0df8c8f7d 100644 --- a/config/arm/arm64_dpaa2_linuxapp_gcc +++ b/config/arm/arm64_dpaa2_linuxapp_gcc @@ -4,6 +4,7 @@ cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-ar' as = 'aarch64-linux-gnu-as' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/config/arm/arm64_dpaa_linuxapp_gcc b/config/arm/arm64_dpaa_linuxapp_gcc index 73a8f0b81..f4b85a84b 100644 --- a/config/arm/arm64_dpaa_linuxapp_gcc +++ b/config/arm/arm64_dpaa_linuxapp_gcc @@ -4,6 +4,7 @@ cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-ar' as = 'aarch64-linux-gnu-as' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc index 967d9d46d..14b801998 100644 --- a/config/arm/arm64_thunderx_linuxapp_gcc +++ b/config/arm/arm64_thunderx_linuxapp_gcc @@ -3,6 +3,7 @@ c = 'aarch64-linux-gnu-gcc' cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-gcc-ar' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build index 0c4e0201a..2c2fd11e4 100644 --- a/drivers/net/pcap/meson.build +++ b/drivers/net/pcap/meson.build @@ -1,12 +1,20 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -pcap_dep = cc.find_library('pcap', required: false) -if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) +pcap_dep = dependency('pcap', required: false) +if pcap_dep.found() build = true else - build = false + # 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) + if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) + build = true + pkgconfig_extra_libs += '-lpcap' + else + build = false + endif endif sources = files('rte_eth_pcap.c') ext_deps += pcap_dep -pkgconfig_extra_libs += '-lpcap' -- 2.20.1