Commit 3e3fbf91 authored by Yuriy Umanets's avatar Yuriy Umanets Committed by Tomasz Zawadzki
Browse files

configure: Checking if libbsd is used by DPDK



- DPDK may or may not decide to use libbsd. SPDK needs to find this out
  and add -lbsd to the list of libraries to prevent linking issues in
  case that --with-dpdk=dpdk/install option is used.
- Use pkg-config for proper detection if the libbsd is in use.

Signed-off-by: default avatarYuriy Umanets <yumanets@nvidia.com>
Change-Id: Ie3de0363fefb9b7337394b00adc862839834f164
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11616


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 avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 7b04eb72
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -195,3 +195,6 @@ CONFIG_USDT=n
# Build with IDXD kernel support.
# In this mode, SPDK shares the DSA device with the kernel.
CONFIG_IDXD_KERNEL=n

# Is DPDK using libbsd?
CONFIG_HAVE_LIBBSD=n
+13 −1
Original line number Diff line number Diff line
@@ -319,6 +319,9 @@ for i in "$@"; do
				CONFIG[DPDK_LIB_DIR]=$dpdk_libdir
				CONFIG[DPDK_INC_DIR]=$dpdk_incdir
				CONFIG[DPDK_PKG_CONFIG]=y
				if pkg-config --print-requires libdpdk | grep "libbsd" > /dev/null 2>&1; then
					CONFIG[HAVE_LIBBSD]=y
				fi
				CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libdpdk)"
			else
				echo "libdpdk.pc not found, aborting"
@@ -341,9 +344,18 @@ for i in "$@"; do
					echo "ERROR: do you have another DPDK installed in the system?"
					exit 1
				fi

				dpdk_reqs=$(PKG_CONFIG_PATH="$dpdk_libdir/pkgconfig" pkg-config --print-requires libdpdk)
				if echo $dpdk_reqs | grep "libbsd" > /dev/null 2>&1; then
					CONFIG[HAVE_LIBBSD]=y
				fi
				CFLAGS="${CFLAGS:+$CFLAGS }$(PKG_CONFIG_PATH="$dpdk_libdir/pkgconfig" pkg-config --cflags libdpdk)"
				dpdk_incdir=$(PKG_CONFIG_PATH="$dpdk_libdir/pkgconfig" pkg-config --variable=includedir libdpdk)
			else
				echo "Using $dpdk_incdir/rte_build_config.h for additional libs..."

				if grep -F "define RTE_USE_LIBBSD 1" $dpdk_incdir/rte_build_config.h > /dev/null 2>&1; then
					CONFIG[HAVE_LIBBSD]=y
				fi
			fi
			echo "DPDK libraries: $dpdk_libdir"
			echo "DPDK includes: $dpdk_incdir"
+4 −0
Original line number Diff line number Diff line
@@ -144,6 +144,10 @@ ifeq ($(CONFIG_IPSEC_MB),y)
DPDK_PRIVATE_LINKER_ARGS += -lIPSec_MB -L$(IPSEC_MB_DIR)
endif

ifeq ($(CONFIG_HAVE_LIBBSD),y)
DPDK_PRIVATE_LINKER_ARGS += -lbsd
endif

ifeq ($(CONFIG_REDUCE),y)
DPDK_PRIVATE_LINKER_ARGS += -lisal -L$(ISAL_DIR)/.libs
ifeq ($(CONFIG_REDUCE_MLX5),y)
+4 −0
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@ override LDFLAGS += \
	-Wl,--no-whole-archive \
	-ldl -pthread -lrt -lrdmacm -lnuma -libverbs

ifeq ($(CONFIG_HAVE_LIBBSD),y)
override LDFLAGS += -lbsd
endif

ifeq ($(CONFIG_ISAL), y)
ISAL_DIR=$(SPDK_ROOT_DIR)/isa-l
override LDFLAGS += -L$(ISAL_DIR)/.libs -lisal