Commit 1e6db5fb authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

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: default avatarTomasz 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
parent c802dbe9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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..."