configure: fix sysroot for cross-compiled DPDK

When cross-compiling DPDK and changing the PKG_CONFIG_SYSROOT_DIR,
the resulting .pc files do not include it in libdir and includedir
variables.

To get the actual paths, those two variables need to be appended
with pc_sysrootdir.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic45f5d2d25c24284561f4f022ca8631f3bfbae07
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12397
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
This commit is contained in:
Tomasz Zawadzki 2022-04-27 17:20:40 +02:00
parent c802dbe9fe
commit 1e6db5fb89

5
configure vendored
View File

@ -400,8 +400,9 @@ for i in "$@"; do
# Can we use pkg-config?
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..."
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=$(readlink -f $dpdk_libdir)
dpdk_libdir=$(readlink -f "${sysroot_dir}$dpdk_libdir")
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: do you have another DPDK installed in the system?"
@ -412,7 +413,7 @@ for i in "$@"; do
CONFIG[HAVE_LIBBSD]=y
fi
CFLAGS="${CFLAGS:+$CFLAGS }$(PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --cflags libdpdk)"
dpdk_incdir=$(PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --variable=includedir libdpdk)
dpdk_incdir="${sysroot_dir}$(PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --variable=includedir libdpdk)"
check_IPSec_mb "pkg-config" "$dpdk_libdir" "$dpdk_incdir"
else
echo "Using $dpdk_incdir/rte_build_config.h for additional libs..."