dpdkbuild: remove RTE_HAS_LIBARCHIVE from build config

DPDK rte_eal_firmware.c will use libarchive APIs when
libarchive is installed on the system.  SPDK doesn't
currently account for this, so if the user has
libarchive installed, DPDK will emit libarchive calls
that don't get resolved during link phase for static
builds.

We've had a similar situation with libbsd for a long
time, where we remove the associated #define from the
DPDK build config header file before we kick off the
DPDK build.  So extend that here for the
RTE_HAS_LIBARCHIVE #define.

It would be nicer to use pkg-config somehow to
generate the necessarily libraries to install on the
SPDK link line for static builds. But it's not
exactly straightforward, so this solution ended up
being the simplest by far, extending a mechanism
that's worked well with SPDK's dpdkbuild up until
this point.

Fixes issue #2357.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I79ff4648ee58a3e13f4b873f8acd1b31cca0fc31
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11385
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Jim Harris 2022-01-29 04:40:57 +00:00
parent 6f0ff37bbd
commit 47dd5b4a35

View File

@ -187,12 +187,12 @@ $(SPDK_ROOT_DIR)/dpdk/build-tmp: $(SPDK_ROOT_DIR)/mk/cc.mk $(SPDK_ROOT_DIR)/incl
$(Q)cd "$(SPDK_ROOT_DIR)/dpdk"; CC="$(SUB_CC)" meson --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")" 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 dependency when it's available. This means any app will be \
# forced to link with -lbsd, 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 when \
# required. For now just remove the libbsd dependency. DPDK will fallback to its internal \
# functions.
# 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:
$(Q)rm -rf $(SPDK_ROOT_DIR)/dpdk/build $(SPDK_ROOT_DIR)/dpdk/build-tmp