build: explicitly clear pkg-config sysroot env

depending on building environment "pkg-config --variable=libdir"
might return absolute path (including sysroot dir) or relative path

this has implication for readlink just below which concatenate strings
including sysroot dir, if sysroot dir occurs in both vars then
readlink will fail and configuration will be terminated

it seems like a grey area of pkg-config documentaion, the behavior is
not well defined and consistent across pkg-config versions

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Signed-off-by: Lei Li <lei.l.li@intel.com>
Change-Id: I3ab459632ff656b40f87c42cc7b1527982a33545
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14294
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Jacek Kalwas 2022-08-31 11:11:13 -04:00 committed by Tomasz Zawadzki
parent 8216e70a14
commit e9438453d4

2
configure vendored
View File

@ -415,7 +415,7 @@ for i in "$@"; do
if command -v "pkg-config" > /dev/null 2>&1 && PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --exists libdpdk; then if command -v "pkg-config" > /dev/null 2>&1 && PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --exists libdpdk; then
echo "Using $dpdk_libdir/pkgconfig for additional libs..." echo "Using $dpdk_libdir/pkgconfig for additional libs..."
sysroot_dir=$(PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --variable=pc_sysrootdir libdpdk) sysroot_dir=$(PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --variable=pc_sysrootdir libdpdk)
dpdk_libdir=$(PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --variable=libdir libdpdk) dpdk_libdir=$(PKG_CONFIG_SYSROOT_DIR='' PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --variable=libdir libdpdk)
dpdk_libdir=$(readlink -f "${sysroot_dir}$dpdk_libdir") dpdk_libdir=$(readlink -f "${sysroot_dir}$dpdk_libdir")
if ! echo $dpdk_libdir | grep $dpdk_dir > /dev/null 2>&1; then if ! echo $dpdk_libdir | grep $dpdk_dir > /dev/null 2>&1; then
echo "ERROR: pkg-config reported DPDK libdir $dpdk_libdir is out of the directory specified with --with-dpdk=" echo "ERROR: pkg-config reported DPDK libdir $dpdk_libdir is out of the directory specified with --with-dpdk="