Commit 25ac67f1 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

build, config: set CONFIG_HAVE_LIBBSD when libbsd available



Previously we would only set this if we detected that
the DPDK specified using --with-dpdk required it.  When
using the DPDK submodule, we would always strip
RTE_USE_LIBBSD to keep DPDK from trying to use it.
This is fragile and unnecessarily complex though - if
libbsd exists, just always add -lbsd to the link line.

Next patch will do the same for libarchive.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I94dd792b392c23a705dead47947b33d899db8f4f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15950


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJohn Levon <levon@movementarian.org>
parent 28092d2f
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -379,9 +379,6 @@ 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)"
				check_IPSec_mb "pkg-config" "$dpdk_libdir" "$dpdk_incdir"
			else
@@ -406,19 +403,12 @@ for i in "$@"; do
					echo "ERROR: do you have another DPDK installed in the system?"
					exit 1
				fi
				dpdk_reqs=$(PKG_CONFIG_PATH="$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="$PKG_CONFIG_PATH:$dpdk_libdir/pkgconfig" pkg-config --cflags 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..."

				if grep -F "define RTE_USE_LIBBSD 1" $dpdk_incdir/rte_build_config.h > /dev/null 2>&1; then
					CONFIG[HAVE_LIBBSD]=y
				fi
				check_IPSec_mb "build-config" "$dpdk_libdir" "$dpdk_incdir"
			fi
			echo "DPDK libraries: $dpdk_libdir"
@@ -790,6 +780,12 @@ if [[ $sys_name == "FreeBSD" ]]; then
	fi
fi

if [[ $sys_name == "Linux" ]]; then
	if pkg-config libbsd; then
		CONFIG[HAVE_LIBBSD]=y
	fi
fi

if [[ $sys_name != "Linux" ]]; then
	if [[ "${CONFIG[VHOST]}" == "y" ]]; then
		echo "Vhost is only supported on Linux."
+0 −6
Original line number Diff line number Diff line
@@ -184,12 +184,6 @@ $(SPDK_ROOT_DIR)/dpdk/build-tmp: $(SPDK_ROOT_DIR)/mk/cc.mk $(SPDK_ROOT_DIR)/incl
	$(Q)rm -rf $(SPDK_ROOT_DIR)/dpdk/build $(SPDK_ROOT_DIR)/dpdk/build-tmp
	$(Q)cd "$(SPDK_ROOT_DIR)/dpdk"; CC="$(SUB_CC)" meson setup --prefix="$(MESON_PREFIX)" --libdir lib -Dc_args="$(DPDK_CFLAGS)" -Dc_link_args="$(DPDK_LDFLAGS)" $(DPDK_OPTS) -Denable_drivers="$(shell echo $(DPDK_DRIVERS) | sed -E "s/ +/,/g")" -Ddisable_libs="$(shell echo $(DPDK_DISABLED_LIBS) | sed -E "s/ +/,/g")" $(DPDKBUILD_FLAGS) build-tmp
	$(Q)sed $(SED_INPLACE_FLAG) 's/#define RTE_EAL_PMD_PATH .*/#define RTE_EAL_PMD_PATH ""/g' $(SPDK_ROOT_DIR)/dpdk/build-tmp/rte_build_config.h
	$(Q) \
	# TODO Meson build adds libbsd and/or libarchive dependency when it's available. This means any app will be \
	# forced to link with -lbsd and/or -larchive, but only if it's available on the system. The clean way to \
	# handle this would be to rely on DPDK's pkg-config file which will contain the -lbsd/-larchive when \
	# required. For now just remove the dependencies. DPDK will fallback to its internal functions.
	$(Q)sed $(SED_INPLACE_FLAG) 's/#define RTE_USE_LIBBSD .*//g' $(SPDK_ROOT_DIR)/dpdk/build-tmp/rte_build_config.h
	$(Q)sed $(SED_INPLACE_FLAG) 's/#define RTE_HAS_LIBARCHIVE .*//g' $(SPDK_ROOT_DIR)/dpdk/build-tmp/rte_build_config.h

clean: