make: use CXX to build libraries with C++ code
If a library contains C++ code, use a C++ compiler when creating a shared object. This ensures that the standard C++ libraries are listed as dependencies. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Icc5321a628682e6dbdab0c053784e0750ebd29c2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9448 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: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
d3d6f74ca1
commit
a746dd6e60
@ -343,12 +343,12 @@ LINK_CXX=\
|
||||
|
||||
# Provide function to ease build of a shared lib
|
||||
define spdk_build_realname_shared_lib
|
||||
$(CC) -o $@ -shared $(CPPFLAGS) $(LDFLAGS) \
|
||||
$(1) -o $@ -shared $(CPPFLAGS) $(LDFLAGS) \
|
||||
-Wl,-rpath=$(DESTDIR)/$(libdir) \
|
||||
-Wl,--soname,$(notdir $@) \
|
||||
-Wl,--whole-archive $(1) -Wl,--no-whole-archive \
|
||||
-Wl,--version-script=$(2) \
|
||||
$(3) -Wl,--no-as-needed $(4) -Wl,--as-needed
|
||||
-Wl,--whole-archive $(2) -Wl,--no-whole-archive \
|
||||
-Wl,--version-script=$(3) \
|
||||
$(4) -Wl,--no-as-needed $(5) -Wl,--as-needed
|
||||
endef
|
||||
|
||||
BUILD_LINKERNAME_LIB=\
|
||||
|
@ -85,6 +85,12 @@ ifeq ($(SPDK_NO_LIB_DEPS),)
|
||||
SPDK_DEP_LIBS = $(call spdk_lib_list_to_shared_libs,$(DEPDIRS-$(LIBNAME)))
|
||||
endif
|
||||
|
||||
ifeq ($(CXX_SRCS),)
|
||||
COMPILER=$(CC)
|
||||
else
|
||||
COMPILER=$(CXX)
|
||||
endif
|
||||
|
||||
MODULES-bdev = spdk_bdev_modules
|
||||
MODULES-sock = spdk_sock_modules
|
||||
MODULES-accel = spdk_accel_modules
|
||||
@ -106,7 +112,7 @@ $(SHARED_LINKED_LIB): $(SHARED_REALNAME_LIB)
|
||||
|
||||
$(SHARED_REALNAME_LIB): $(LIB)
|
||||
$(Q)echo " SO $(notdir $@)"; \
|
||||
$(call spdk_build_realname_shared_lib,$^,$(SPDK_MAP_FILE),$(LOCAL_SYS_LIBS),$(SPDK_DEP_LIBS))
|
||||
$(call spdk_build_realname_shared_lib,$(COMPILER),$^,$(SPDK_MAP_FILE),$(LOCAL_SYS_LIBS),$(SPDK_DEP_LIBS))
|
||||
|
||||
define pkgconfig_create
|
||||
$(Q)$(SPDK_ROOT_DIR)/scripts/pc.sh $(1) $(LIBNAME) $(SO_SUFFIX) \
|
||||
|
Loading…
Reference in New Issue
Block a user