Skip to contentSkip to conversation

build: force pkg-config for dependency detection

PATCH Applied Bruce Richardson 7 participants 7 messages Jan 18, 2021 – Jan 25, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: force pkg-config for dependency detection

Meson can use cmake as a fallback for detecting packages, and this can lead to picking up 64-libs for 32-bit builds. To work around this, force the use of pkg-config only for detecting libcrypto, zlib, jansson and other package dependencies.

---

NOTE, as I do not have all packages for DPDK on my system I have not verified that pkg-config files are present for all dependencies, specifically:
* libAArch64crypto
* netcope-common (which in error message is reported as "libnfb"?)
* libsze2
Maintainers, please double check these work ok.

---
 app/test/meson.build                  | 2 +-
 config/meson.build                    | 2 +-
 drivers/common/mlx5/linux/meson.build | 3 ++-
 drivers/common/mvep/meson.build       | 2 +-
 drivers/common/qat/meson.build        | 2 +-
 drivers/compress/isal/meson.build     | 2 +-
 drivers/compress/zlib/meson.build     | 2 +-
 drivers/crypto/armv8/meson.build      | 2 +-
 drivers/crypto/ccp/meson.build        | 2 +-
 drivers/crypto/mvsam/meson.build      | 2 +-
 drivers/crypto/openssl/meson.build    | 2 +-
 drivers/crypto/qat/meson.build        | 2 +-
 drivers/net/af_xdp/meson.build        | 5 +++--
 drivers/net/bnx2x/meson.build         | 2 +-
 drivers/net/mlx4/meson.build          | 3 ++-
 drivers/net/mvneta/meson.build        | 2 +-
 drivers/net/mvpp2/meson.build         | 2 +-
 drivers/net/nfb/meson.build           | 2 +-
 drivers/net/szedata2/meson.build      | 2 +-
 examples/vm_power_manager/meson.build | 2 +-
 lib/librte_bpf/meson.build            | 2 +-
 lib/librte_metrics/meson.build        | 2 +-
 22 files changed, 26 insertions(+), 23 deletions(-)
app/test/meson.build +1 -1
index bb06a9243..d0d1d1998 100644
@@ -407,7 +407,7 @@ cflags += ['-DALLOW_INTERNAL_API']
 
 test_dep_objs = []
 if dpdk_conf.has('RTE_LIB_COMPRESSDEV')
-	compress_test_dep = dependency('zlib', required: false)
+	compress_test_dep = dependency('zlib', required: false, method: 'pkg-config')
 	if compress_test_dep.found()
 		test_dep_objs += compress_test_dep
 		test_sources += 'test_compressdev.c'
config/meson.build +1 -1
index a3154e29c..d699a8622 100644
@@ -160,7 +160,7 @@ if fdt_dep.found() and cc.has_header('fdt.h')
 endif
 
 # check for libbsd
-libbsd = dependency('libbsd', required: false)
+libbsd = dependency('libbsd', required: false, method: 'pkg-config')
 if libbsd.found()
 	dpdk_conf.set('RTE_USE_LIBBSD', 1)
 endif
drivers/common/mlx5/linux/meson.build +2 -1
index 580419e6d..220de3542 100644
@@ -19,7 +19,8 @@ endif
 libnames = [ 'mlx5', 'ibverbs' ]
 libs = []
 foreach libname:libnames
-	lib = dependency('lib' + libname, static:static_ibverbs, required:false)
+	lib = dependency('lib' + libname, static:static_ibverbs,
+			required:false, method: 'pkg-config')
 	if not lib.found() and not static_ibverbs
 		lib = cc.find_library(libname, required:false)
 	endif
drivers/common/mvep/meson.build +1 -1
index 863a20ab9..7cd968b38 100644
@@ -4,7 +4,7 @@
 # All rights reserved.
 #
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/common/qat/meson.build +1 -1
index 29e1299f2..b2915c91f 100644
@@ -23,7 +23,7 @@ if disabled_drivers.contains(qat_compress_path)
 			'Explicitly disabled via build config')
 endif
 
-libcrypto = dependency('libcrypto', required: false)
+libcrypto = dependency('libcrypto', required: false, method: 'pkg-config')
 if qat_crypto and not libcrypto.found()
 	qat_crypto = false
 	dpdk_drvs_disabled += qat_crypto_path
drivers/compress/isal/meson.build +1 -1
index 5ee17e28f..d847c2ea6 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 Intel Corporation
 
-dep = dependency('libisal', required: false)
+dep = dependency('libisal', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libisal"'
drivers/compress/zlib/meson.build +1 -1
index b19a6d2b1..82cf0dddd 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Cavium Networks
 
-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "zlib"'
drivers/crypto/armv8/meson.build +1 -1
index 3289a2adc..027173bc1 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Arm Limited
 
-dep = dependency('libAArch64crypto', required: false)
+dep = dependency('libAArch64crypto', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libAArch64crypto"'
drivers/crypto/ccp/meson.build +1 -1
index a0e0b379e..ff66427ae 100644
@@ -5,7 +5,7 @@ if not is_linux
 	build = false
 	reason = 'only supported on Linux'
 endif
-dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libcrypto"'
drivers/crypto/mvsam/meson.build +1 -1
index 384eacff0..b4c55b5ff 100644
@@ -3,7 +3,7 @@
 # Copyright(c) 2018 Semihalf.
 # All rights reserved.
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/crypto/openssl/meson.build +1 -1
index d9ac69897..47fb2bb75 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libcrypto"'
drivers/crypto/qat/meson.build +1 -1
index bc90ec44c..92e0ed656 100644
@@ -5,7 +5,7 @@
 # driver which comes later. Here we just add our sources files to the list
 build = false
 reason = '' # sentinal value to suppress printout
-dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 qat_includes += include_directories('.')
 qat_deps += 'cryptodev'
 qat_deps += 'net'
drivers/net/af_xdp/meson.build +3 -2
index dce123036..60ccffabb 100644
@@ -9,14 +9,15 @@ endif
 
 sources = files('rte_eth_af_xdp.c')
 
-bpf_dep = dependency('libbpf', required: false)
+bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
 if not bpf_dep.found()
 	bpf_dep = cc.find_library('bpf', required: false)
 endif
 
 if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h')
 	ext_deps += bpf_dep
-	bpf_ver_dep = dependency('libbpf', version : '>=0.2.0', required: false)
+	bpf_ver_dep = dependency('libbpf', version : '>=0.2.0',
+			required: false, method: 'pkg-config')
 	if bpf_ver_dep.found()
 		dpdk_conf.set('RTE_LIBRTE_AF_XDP_PMD_SHARED_UMEM', 1)
 	endif
drivers/net/bnx2x/meson.build +1 -1
index 8837ef424..e260b7592 100644
@@ -7,7 +7,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
 build = dep.found()
 reason = 'missing dependency, "zlib"'
 ext_deps += dep
drivers/net/mlx4/meson.build +2 -1
index 0cf9938a8..d7602b748 100644
@@ -24,7 +24,8 @@ endif
 libnames = [ 'mlx4', 'ibverbs' ]
 libs = []
 foreach libname:libnames
-	lib = dependency('lib' + libname, static:static_ibverbs, required:false)
+	lib = dependency('lib' + libname, static:static_ibverbs,
+			required:false, method: 'pkg-config')
 	if not lib.found() and not static_ibverbs
 		lib = cc.find_library(libname, required:false)
 	endif
drivers/net/mvneta/meson.build +1 -1
index 4e073e0d2..0be7b3d8b 100644
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/net/mvpp2/meson.build +1 -1
index c509d8916..bfda5439b 100644
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/net/nfb/meson.build +1 -1
index 42f7921dc..f4a89b87d 100644
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('netcope-common', required: false)
+dep = dependency('netcope-common', required: false, method: 'pkg-config')
 reason = 'missing dependency, "libnfb"'
 build = dep.found()
 ext_deps += dep
drivers/net/szedata2/meson.build +1 -1
index 4c02830b0..4f8f3325f 100644
@@ -7,7 +7,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libsze2', required: false)
+dep = dependency('libsze2', required: false, method: 'pkg-config')
 build = dep.found()
 reason = 'missing dependency, "libsze2"'
 ext_deps += dep
examples/vm_power_manager/meson.build +1 -1
index 1f813fbe8..637bd2323 100644
@@ -41,7 +41,7 @@ opt_dep = cc.find_library('virt', required : false)
 build = opt_dep.found()
 ext_deps += opt_dep
 
-opt_dep = dependency('jansson', required : false)
+opt_dep = dependency('jansson', required : false, method: 'pkg-config')
 if opt_dep.found()
 	ext_deps += opt_dep
 	cflags += '-DUSE_JANSSON'
lib/librte_bpf/meson.build +1 -1
index 48460e950..614277eff 100644
@@ -19,7 +19,7 @@ headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = dependency('libelf', required: false)
+dep = dependency('libelf', required: false, method: 'pkg-config')
 if dep.found()
 	dpdk_conf.set('RTE_LIBRTE_BPF_ELF', 1)
 	sources += files('bpf_load_elf.c')
lib/librte_metrics/meson.build +1 -1
index eed27b880..28a8cc115 100644
@@ -4,7 +4,7 @@
 sources = files('rte_metrics.c')
 headers = files('rte_metrics.h')
 
-jansson = dependency('jansson', required: false)
+jansson = dependency('jansson', required: false, method: 'pkg-config')
 if jansson.found()
 	ext_deps += jansson
 	sources += files('rte_metrics_telemetry.c')

--
2.27.0

Tested-by on v1 1/1
#1 lore raw
Quoted 28 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Monday, January 18, 2021 10:30 PM
To: [email protected]
Cc: [email protected]; Bruce Richardson <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Viacheslav Ovsiienko <[email protected]>; Liron Himi <[email protected]>; Fiona Trahe <[email protected]>; John Griffin <[email protected]>; Deepak Kumar Jain <[email protected]>; Lee Daly <[email protected]>; Ashish Gupta <[email protected]>; Sunila Sahu <[email protected]>; Ruifeng Wang <[email protected]>; Somalapuram Amaranath <[email protected]>; Michael Shamis <[email protected]>; Declan Doherty <[email protected]>; Ciara Loftus <[email protected]>; Qi Zhang <[email protected]>; Rasesh Mody <[email protected]>; Shahed Shaikh <[email protected]>; Zyta Szpak <[email protected]>; Martin Spinler <[email protected]>; David Hunt <[email protected]>; Konstantin Ananyev <[email protected]>
Subject: [PATCH] build: force pkg-config for dependency detection

Meson can use cmake as a fallback for detecting packages, and this can lead to picking up 64-libs for 32-bit builds. To work around this, force the use of pkg-config only for detecting libcrypto, zlib, jansson and other package dependencies.

Quoted 7 lines

---

NOTE, as I do not have all packages for DPDK on my system I have not verified that pkg-config files are present for all dependencies, specifically:
* libAArch64crypto

Checked the change works OK with libAArch64crypto package.

Quoted 335 lines

* netcope-common (which in error message is reported as "libnfb"?)
* libsze2
Maintainers, please double check these work ok.

---
 app/test/meson.build                  | 2 +-
 config/meson.build                    | 2 +-
 drivers/common/mlx5/linux/meson.build | 3 ++-
 drivers/common/mvep/meson.build       | 2 +-
 drivers/common/qat/meson.build        | 2 +-
 drivers/compress/isal/meson.build     | 2 +-
 drivers/compress/zlib/meson.build     | 2 +-
 drivers/crypto/armv8/meson.build      | 2 +-
 drivers/crypto/ccp/meson.build        | 2 +-
 drivers/crypto/mvsam/meson.build      | 2 +-
 drivers/crypto/openssl/meson.build    | 2 +-
 drivers/crypto/qat/meson.build        | 2 +-
 drivers/net/af_xdp/meson.build        | 5 +++--
 drivers/net/bnx2x/meson.build         | 2 +-
 drivers/net/mlx4/meson.build          | 3 ++-
 drivers/net/mvneta/meson.build        | 2 +-
 drivers/net/mvpp2/meson.build         | 2 +-
 drivers/net/nfb/meson.build           | 2 +-
 drivers/net/szedata2/meson.build      | 2 +-
 examples/vm_power_manager/meson.build | 2 +-
 lib/librte_bpf/meson.build            | 2 +-
 lib/librte_metrics/meson.build        | 2 +-
 22 files changed, 26 insertions(+), 23 deletions(-)
app/test/meson.build index renamed from app/test/meson.build +0 -0

bb06a9243..d0d1d1998 100644

app/test/meson.build +2 -1
@@ -407,7 +407,7 @@ cflags += ['-DALLOW_INTERNAL_API']
 
 test_dep_objs = []
 if dpdk_conf.has('RTE_LIB_COMPRESSDEV')
-	compress_test_dep = dependency('zlib', required: false)
+	compress_test_dep = dependency('zlib', required: false, method:
+'pkg-config')
 	if compress_test_dep.found()
 		test_dep_objs += compress_test_dep
 		test_sources += 'test_compressdev.c'
config/meson.build index renamed from config/meson.build +0 -0

a3154e29c..d699a8622 100644

config/meson.build +1 -1
@@ -160,7 +160,7 @@ if fdt_dep.found() and cc.has_header('fdt.h')  endif
 
 # check for libbsd
-libbsd = dependency('libbsd', required: false)
+libbsd = dependency('libbsd', required: false, method: 'pkg-config')
 if libbsd.found()
 	dpdk_conf.set('RTE_USE_LIBBSD', 1)
 endif
drivers/common/mlx5/linux/meson.build +2 -1
index 580419e6d..220de3542 100644
@@ -19,7 +19,8 @@ endif
 libnames = [ 'mlx5', 'ibverbs' ]
 libs = []
 foreach libname:libnames
-	lib = dependency('lib' + libname, static:static_ibverbs, required:false)
+	lib = dependency('lib' + libname, static:static_ibverbs,
+			required:false, method: 'pkg-config')
 	if not lib.found() and not static_ibverbs
 		lib = cc.find_library(libname, required:false)
 	endif
(quoted diff) +0 -0

b/drivers/common/mvep/meson.build index 863a20ab9..7cd968b38 100644

drivers/common/mvep/meson.build +1 -1
@@ -4,7 +4,7 @@
 # All rights reserved.
 #
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
(quoted diff) +0 -0

b/drivers/common/qat/meson.build index 29e1299f2..b2915c91f 100644

drivers/common/qat/meson.build +2 -1
@@ -23,7 +23,7 @@ if disabled_drivers.contains(qat_compress_path)
 			'Explicitly disabled via build config')  endif
 
-libcrypto = dependency('libcrypto', required: false)
+libcrypto = dependency('libcrypto', required: false, method:
+'pkg-config')
 if qat_crypto and not libcrypto.found()
 	qat_crypto = false
 	dpdk_drvs_disabled += qat_crypto_path
drivers/compress/isal/meson.build +1 -1
index 5ee17e28f..d847c2ea6 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright 2018 Intel Corporation
 
-dep = dependency('libisal', required: false)
+dep = dependency('libisal', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libisal"'
drivers/compress/zlib/meson.build +0 -0
index b19a6d2b1..82cf0dddd 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2018 Cavium

Networks

drivers/compress/zlib/meson.build +1 -1
-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "zlib"'
drivers/crypto/armv8/meson.build +2 -1
index 3289a2adc..027173bc1 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2019 Arm Limited
 
-dep = dependency('libAArch64crypto', required: false)
+dep = dependency('libAArch64crypto', required: false, method:
+'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libAArch64crypto"'
(quoted diff) +0 -0

b/drivers/crypto/ccp/meson.build index a0e0b379e..ff66427ae 100644

drivers/crypto/ccp/meson.build +1 -1
@@ -5,7 +5,7 @@ if not is_linux
 	build = false
 	reason = 'only supported on Linux'
 endif
-dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libcrypto"'
drivers/crypto/mvsam/meson.build +1 -1
index 384eacff0..b4c55b5ff 100644
@@ -3,7 +3,7 @@
 # Copyright(c) 2018 Semihalf.
 # All rights reserved.
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/crypto/openssl/meson.build +0 -0
index d9ac69897..47fb2bb75 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2017 Intel

Corporation

drivers/crypto/openssl/meson.build +1 -1
-dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libcrypto"'
(quoted diff) +0 -0

b/drivers/crypto/qat/meson.build index bc90ec44c..92e0ed656 100644

drivers/crypto/qat/meson.build +0 -0
@@ -5,7 +5,7 @@
 # driver which comes later. Here we just add our sources files to the list

build = false reason = '' # sentinal value to suppress printout -dep = dependency('libcrypto', required: false)

drivers/crypto/qat/meson.build +1 -0
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 qat_includes += include_directories('.')  qat_deps += 'cryptodev'
 qat_deps += 'net'
(quoted diff) +0 -0

b/drivers/net/af_xdp/meson.build index dce123036..60ccffabb 100644

drivers/net/af_xdp/meson.build +3 -2
@@ -9,14 +9,15 @@ endif
 
 sources = files('rte_eth_af_xdp.c')
 
-bpf_dep = dependency('libbpf', required: false)
+bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
 if not bpf_dep.found()
 	bpf_dep = cc.find_library('bpf', required: false)  endif
 
 if bpf_dep.found() and cc.has_header('bpf/xsk.h') and
 cc.has_header('linux/if_xdp.h')
 	ext_deps += bpf_dep
-	bpf_ver_dep = dependency('libbpf', version : '>=0.2.0', required:
 false)
+	bpf_ver_dep = dependency('libbpf', version : '>=0.2.0',
+			required: false, method: 'pkg-config')
 	if bpf_ver_dep.found()
 		dpdk_conf.set('RTE_LIBRTE_AF_XDP_PMD_SHARED_UMEM',

1)

drivers/net/af_xdp/meson.build +0 -0
 	endif
drivers/net/bnx2x/meson.build +1 -1
index 8837ef424..e260b7592 100644
@@ -7,7 +7,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
 build = dep.found()
 reason = 'missing dependency, "zlib"'
 ext_deps += dep
drivers/net/mlx4/meson.build +2 -1
index 0cf9938a8..d7602b748 100644
@@ -24,7 +24,8 @@ endif
 libnames = [ 'mlx4', 'ibverbs' ]
 libs = []
 foreach libname:libnames
-	lib = dependency('lib' + libname, static:static_ibverbs, required:false)
+	lib = dependency('lib' + libname, static:static_ibverbs,
+			required:false, method: 'pkg-config')
 	if not lib.found() and not static_ibverbs
 		lib = cc.find_library(libname, required:false)
 	endif
(quoted diff) +0 -0

b/drivers/net/mvneta/meson.build index 4e073e0d2..0be7b3d8b 100644

drivers/net/mvneta/meson.build +1 -1
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
(quoted diff) +0 -0

b/drivers/net/mvpp2/meson.build index c509d8916..bfda5439b 100644

drivers/net/mvpp2/meson.build +1 -1
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/net/nfb/meson.build +2 -1
index 42f7921dc..f4a89b87d 100644
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('netcope-common', required: false)
+dep = dependency('netcope-common', required: false, method:
+'pkg-config')
 reason = 'missing dependency, "libnfb"'
 build = dep.found()
 ext_deps += dep
drivers/net/szedata2/meson.build +1 -1
index 4c02830b0..4f8f3325f 100644
@@ -7,7 +7,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libsze2', required: false)
+dep = dependency('libsze2', required: false, method: 'pkg-config')
 build = dep.found()
 reason = 'missing dependency, "libsze2"'
 ext_deps += dep
examples/vm_power_manager/meson.build +0 -0
index 1f813fbe8..637bd2323 100644
@@ -41,7 +41,7 @@ opt_dep = cc.find_library('virt', required : false)  build =

opt_dep.found() ext_deps += opt_dep

examples/vm_power_manager/meson.build +1 -1
-opt_dep = dependency('jansson', required : false)
+opt_dep = dependency('jansson', required : false, method: 'pkg-config')
 if opt_dep.found()
 	ext_deps += opt_dep
 	cflags += '-DUSE_JANSSON'
lib/librte_bpf/meson.build index renamed from lib/librte_bpf/meson.build +0 -0

48460e950..614277eff 100644

lib/librte_bpf/meson.build +1 -1
@@ -19,7 +19,7 @@ headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = dependency('libelf', required: false)
+dep = dependency('libelf', required: false, method: 'pkg-config')
 if dep.found()
 	dpdk_conf.set('RTE_LIBRTE_BPF_ELF', 1)
 	sources += files('bpf_load_elf.c')
lib/librte_metrics/meson.build +1 -2
index eed27b880..28a8cc115 100644
@@ -4,7 +4,7 @@
 sources = files('rte_metrics.c')
 headers = files('rte_metrics.h')
 
-jansson = dependency('jansson', required: false)
+jansson = dependency('jansson', required: false, method: 'pkg-config')
 if jansson.found()
 	ext_deps += jansson
 	sources += files('rte_metrics_telemetry.c')
--

2.27.0

Tested-by on v1 1/1
#3 lore raw
In reply to Bruce Richardson

libmusdk works with this change.

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Monday, 18 January 2021 16:30
To: [email protected]
Cc: [email protected]; Bruce Richardson <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Viacheslav Ovsiienko <[email protected]>; Liron Himi <[email protected]>; Fiona Trahe <[email protected]>; John Griffin <[email protected]>; Deepak Kumar Jain <[email protected]>; Lee Daly <[email protected]>; Ashish Gupta <[email protected]>; Sunila Sahu <[email protected]>; Ruifeng Wang <[email protected]>; Somalapuram Amaranath <[email protected]>; Michael Shamis <[email protected]>; Declan Doherty <[email protected]>; Ciara Loftus <[email protected]>; Qi Zhang <[email protected]>; Rasesh Mody <[email protected]>; Shahed Shaikh <[email protected]>; Zyta Szpak <[email protected]>; Martin Spinler <[email protected]>; David Hunt <[email protected]>; Konstantin Ananyev <[email protected]>
Subject: [EXT] [PATCH] build: force pkg-config for dependency detection

External Email

----------------------------------------------------------------------
Meson can use cmake as a fallback for detecting packages, and this can lead to picking up 64-libs for 32-bit builds. To work around this, force the use of pkg-config only for detecting libcrypto, zlib, jansson and other package dependencies.

---

NOTE, as I do not have all packages for DPDK on my system I have not verified that pkg-config files are present for all dependencies, specifically:
* libAArch64crypto
* netcope-common (which in error message is reported as "libnfb"?)
* libsze2
Maintainers, please double check these work ok.

---
 app/test/meson.build                  | 2 +-
 config/meson.build                    | 2 +-
 drivers/common/mlx5/linux/meson.build | 3 ++-
 drivers/common/mvep/meson.build       | 2 +-
 drivers/common/qat/meson.build        | 2 +-
 drivers/compress/isal/meson.build     | 2 +-
 drivers/compress/zlib/meson.build     | 2 +-
 drivers/crypto/armv8/meson.build      | 2 +-
 drivers/crypto/ccp/meson.build        | 2 +-
 drivers/crypto/mvsam/meson.build      | 2 +-
 drivers/crypto/openssl/meson.build    | 2 +-
 drivers/crypto/qat/meson.build        | 2 +-
 drivers/net/af_xdp/meson.build        | 5 +++--
 drivers/net/bnx2x/meson.build         | 2 +-
 drivers/net/mlx4/meson.build          | 3 ++-
 drivers/net/mvneta/meson.build        | 2 +-
 drivers/net/mvpp2/meson.build         | 2 +-
 drivers/net/nfb/meson.build           | 2 +-
 drivers/net/szedata2/meson.build      | 2 +-
 examples/vm_power_manager/meson.build | 2 +-
 lib/librte_bpf/meson.build            | 2 +-
 lib/librte_metrics/meson.build        | 2 +-
 22 files changed, 26 insertions(+), 23 deletions(-)
app/test/meson.build +2 -1
@@ -407,7 +407,7 @@ cflags += ['-DALLOW_INTERNAL_API']
 
 test_dep_objs = []
 if dpdk_conf.has('RTE_LIB_COMPRESSDEV')
-	compress_test_dep = dependency('zlib', required: false)
+	compress_test_dep = dependency('zlib', required: false, method: 
+'pkg-config')
 	if compress_test_dep.found()
 		test_dep_objs += compress_test_dep

test_sources += 'test_compressdev.c'

config/meson.build +1 -1
@@ -160,7 +160,7 @@ if fdt_dep.found() and cc.has_header('fdt.h')  endif
 
 # check for libbsd
-libbsd = dependency('libbsd', required: false)
+libbsd = dependency('libbsd', required: false, method: 'pkg-config')
 if libbsd.found()
 	dpdk_conf.set('RTE_USE_LIBBSD', 1)
 endif
drivers/common/mlx5/linux/meson.build +2 -1
index 580419e6d..220de3542 100644
@@ -19,7 +19,8 @@ endif
 libnames = [ 'mlx5', 'ibverbs' ]
 libs = []
 foreach libname:libnames
-	lib = dependency('lib' + libname, static:static_ibverbs, required:false)
+	lib = dependency('lib' + libname, static:static_ibverbs,
+			required:false, method: 'pkg-config')
 	if not lib.found() and not static_ibverbs
 		lib = cc.find_library(libname, required:false)
 	endif
drivers/common/mvep/meson.build +1 -1
@@ -4,7 +4,7 @@
 # All rights reserved.
 #
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/common/qat/meson.build +2 -1
@@ -23,7 +23,7 @@ if disabled_drivers.contains(qat_compress_path)
 			'Explicitly disabled via build config')  endif
 
-libcrypto = dependency('libcrypto', required: false)
+libcrypto = dependency('libcrypto', required: false, method: 
+'pkg-config')
 if qat_crypto and not libcrypto.found()
 	qat_crypto = false
 	dpdk_drvs_disabled += qat_crypto_path
drivers/compress/isal/meson.build +1 -1
index 5ee17e28f..d847c2ea6 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright 2018 Intel Corporation
 
-dep = dependency('libisal', required: false)
+dep = dependency('libisal', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libisal"'
drivers/compress/zlib/meson.build +1 -1
index b19a6d2b1..82cf0dddd 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2018 Cavium Networks
 
-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "zlib"'
drivers/crypto/armv8/meson.build +2 -1
index 3289a2adc..027173bc1 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2019 Arm Limited
 
-dep = dependency('libAArch64crypto', required: false)
+dep = dependency('libAArch64crypto', required: false, method: 
+'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libAArch64crypto"'
drivers/crypto/ccp/meson.build +1 -1
@@ -5,7 +5,7 @@ if not is_linux
 	build = false
 	reason = 'only supported on Linux'
 endif
-dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libcrypto"'
drivers/crypto/mvsam/meson.build +1 -1
index 384eacff0..b4c55b5ff 100644
@@ -3,7 +3,7 @@
 # Copyright(c) 2018 Semihalf.
 # All rights reserved.
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/crypto/openssl/meson.build +1 -1
index d9ac69897..47fb2bb75 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2017 Intel Corporation
 
-dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libcrypto"'
drivers/crypto/qat/meson.build +1 -0
@@ -5,7 +5,7 @@
 # driver which comes later. Here we just add our sources files to the list  build = false  reason = '' # sentinal value to suppress printout -dep = dependency('libcrypto', required: false)
+dep = dependency('libcrypto', required: false, method: 'pkg-config')
 qat_includes += include_directories('.')  qat_deps += 'cryptodev'
 qat_deps += 'net'
drivers/net/af_xdp/meson.build +3 -2
@@ -9,14 +9,15 @@ endif
 
 sources = files('rte_eth_af_xdp.c')
 
-bpf_dep = dependency('libbpf', required: false)
+bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
 if not bpf_dep.found()
 	bpf_dep = cc.find_library('bpf', required: false)  endif
 
 if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h')
 	ext_deps += bpf_dep
-	bpf_ver_dep = dependency('libbpf', version : '>=0.2.0', required: false)
+	bpf_ver_dep = dependency('libbpf', version : '>=0.2.0',
+			required: false, method: 'pkg-config')
 	if bpf_ver_dep.found()
 		dpdk_conf.set('RTE_LIBRTE_AF_XDP_PMD_SHARED_UMEM', 1)
 	endif
drivers/net/bnx2x/meson.build +1 -1
@@ -7,7 +7,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('zlib', required: false)
+dep = dependency('zlib', required: false, method: 'pkg-config')
 build = dep.found()
 reason = 'missing dependency, "zlib"'
 ext_deps += dep
drivers/net/mlx4/meson.build +2 -1
@@ -24,7 +24,8 @@ endif
 libnames = [ 'mlx4', 'ibverbs' ]
 libs = []
 foreach libname:libnames
-	lib = dependency('lib' + libname, static:static_ibverbs, required:false)
+	lib = dependency('lib' + libname, static:static_ibverbs,
+			required:false, method: 'pkg-config')
 	if not lib.found() and not static_ibverbs
 		lib = cc.find_library(libname, required:false)
 	endif
drivers/net/mvneta/meson.build +1 -1
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/net/mvpp2/meson.build +1 -1
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libmusdk', required: false)
+dep = dependency('libmusdk', required: false, method: 'pkg-config')
 if not dep.found()
 	build = false
 	reason = 'missing dependency, "libmusdk"'
drivers/net/nfb/meson.build +2 -1
@@ -9,7 +9,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('netcope-common', required: false)
+dep = dependency('netcope-common', required: false, method: 
+'pkg-config')
 reason = 'missing dependency, "libnfb"'
 build = dep.found()

ext_deps += dep

drivers/net/szedata2/meson.build +1 -1
index 4c02830b0..4f8f3325f 100644
@@ -7,7 +7,7 @@ if is_windows
 	subdir_done()
 endif
 
-dep = dependency('libsze2', required: false)
+dep = dependency('libsze2', required: false, method: 'pkg-config')
 build = dep.found()
 reason = 'missing dependency, "libsze2"'
 ext_deps += dep
examples/vm_power_manager/meson.build +1 -1
index 1f813fbe8..637bd2323 100644
@@ -41,7 +41,7 @@ opt_dep = cc.find_library('virt', required : false)  build = opt_dep.found()  ext_deps += opt_dep
 
-opt_dep = dependency('jansson', required : false)
+opt_dep = dependency('jansson', required : false, method: 'pkg-config')
 if opt_dep.found()
 	ext_deps += opt_dep
 	cflags += '-DUSE_JANSSON'
lib/librte_bpf/meson.build +1 -1
@@ -19,7 +19,7 @@ headers = files('bpf_def.h',
 
 deps += ['mbuf', 'net', 'ethdev']
 
-dep = dependency('libelf', required: false)
+dep = dependency('libelf', required: false, method: 'pkg-config')
 if dep.found()
 	dpdk_conf.set('RTE_LIBRTE_BPF_ELF', 1)
 	sources += files('bpf_load_elf.c')
lib/librte_metrics/meson.build +1 -1
@@ -4,7 +4,7 @@
 sources = files('rte_metrics.c')
 headers = files('rte_metrics.h')
 
-jansson = dependency('jansson', required: false)
+jansson = dependency('jansson', required: false, method: 'pkg-config')
 if jansson.found()
 	ext_deps += jansson
 	sources += files('rte_metrics_telemetry.c')

--
2.27.0

Tested-by on v1 1/1
#4 lore raw
In reply to Bruce Richardson
Quoted 29 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Monday, January 18, 2021 2:30 PM
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Viacheslav Ovsiienko <[email protected]>; Liron Himi <[email protected]>; Trahe, Fiona <[email protected]>; Griffin, John <[email protected]>; Jain, Deepak K <[email protected]>; Daly, Lee <[email protected]>; Ashish Gupta <[email protected]>; Sunila Sahu <[email protected]>; Ruifeng Wang <[email protected]>; Somalapuram Amaranath <[email protected]>; Michael Shamis <[email protected]>; Doherty, Declan <[email protected]>; Loftus, Ciara <[email protected]>; Zhang, Qi Z <[email protected]>; Rasesh Mody <[email protected]>; Shahed Shaikh <[email protected]>; Zyta Szpak <[email protected]>; Martin Spinler <[email protected]>; Hunt, David <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: [PATCH] build: force pkg-config for dependency detection

Meson can use cmake as a fallback for detecting packages, and this can lead to picking up 64-libs for 32-bit builds. To work around this, force the use of pkg-config only for detecting libcrypto, zlib, jansson and other package dependencies.

Quoted 5 lines

---

Tested ISA-L driver change. Thanks.

#6 lore raw
In reply to Bruce Richardson

18/01/2021 15:29, Bruce Richardson:

Quoted 8 lines

Meson can use cmake as a fallback for detecting packages, and this can lead to picking up 64-libs for 32-bit builds. To work around this, force the use of pkg-config only for detecting libcrypto, zlib, jansson and other package dependencies.

That's "fun" how doing a compilation "right" may be difficult.

Applied, thanks