From f758833ef8f5845aaea525c50d725145ecdc186c Mon Sep 17 00:00:00 2001 From: Jacek Kalwas Date: Fri, 12 Feb 2021 13:28:04 -0500 Subject: [PATCH] build: combine env_dpdk / event_bdev so pkgconfig can de-duplicate deps - it shows nice feature and usage of pkg-config - it also prevents from duplicate symbols issue for static build in case listed libs have a common dependencies Signed-off-by: Jacek Kalwas Change-Id: I1f470d202ea7efe03e354dca472fd50e97bca747 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6406 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Tomasz Zawadzki --- test/external_code/hello_world/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/external_code/hello_world/Makefile b/test/external_code/hello_world/Makefile index be17800fd..4e5de3ebd 100644 --- a/test/external_code/hello_world/Makefile +++ b/test/external_code/hello_world/Makefile @@ -35,6 +35,7 @@ PKG_CONFIG_PATH = $(SPDK_LIB_DIR)/pkgconfig DPDK_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs spdk_env_dpdk) SPDK_BDEV_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs spdk_event_bdev) +SPDK_DPDK_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs spdk_event_bdev spdk_env_dpdk) SYS_LIB := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs --static spdk_syslibs) # Shows how to compile both an external bdev and an external application against the SPDK combined shared object and dpdk shared objects. @@ -59,10 +60,10 @@ alone_shared_iso: # Shows how to compile an external application against the SPDK archives. alone_static: - $(CC) $(COMMON_CFLAGS) -o hello_bdev ./hello_bdev.c -pthread -Wl,--whole-archive,-Bstatic $(SPDK_BDEV_LIB) \ - $(DPDK_LIB) -Wl,--no-whole-archive,-Bdynamic $(SYS_LIB) + $(CC) $(COMMON_CFLAGS) -o hello_bdev ./hello_bdev.c -pthread -Wl,--whole-archive,-Bstatic \ + $(SPDK_DPDK_LIB) -Wl,--no-whole-archive,-Bdynamic $(SYS_LIB) # Shows how to compile and external bdev and application sgainst the SPDK archives. bdev_static: - $(CC) $(COMMON_CFLAGS) -L../passthru -o hello_bdev ./hello_bdev.c -pthread -Wl,--whole-archive,-Bstatic -lpassthru_external $(SPDK_BDEV_LIB) $(DPDK_LIB) \ + $(CC) $(COMMON_CFLAGS) -L../passthru -o hello_bdev ./hello_bdev.c -pthread -Wl,--whole-archive,-Bstatic -lpassthru_external $(SPDK_DPDK_LIB) \ -Wl,--no-whole-archive,-Bdynamic $(SYS_LIB)