When building DPDK with "make" and options
CONFIG_RTE_USE_LIBBSD=y
and
CONFIG_RTE_BUILD_SHARED_LIB=y
libbsd was not linked, resulting in compilation errors:
undefined reference to `strlcpy'
The link option -lbsd is added in a common place for both
Linux apps and libs.
It is used in app linkage via EXECENV_LDLIBS,
and in lib linkage via the added variable EXECENV_LDLIBS-y.
Fixes:
5364de644a4b ("eal: support strlcpy function")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
EXECENV_LDLIBS += -lgcc_s
endif
+EXECENV_LDLIBS-$(CONFIG_RTE_USE_LIBBSD) += -lbsd
+
# force applications to link with gcc/icc instead of using ld
LINK_USING_CC := 1
# Add library to the group to resolve symbols
EXECENV_LDLIBS += -ldl
+# EXECENV_LDLIBS-y applies to lib.so and app linking
+# while EXECENV_LDLIBS applies only to app linking.
+EXECENV_LDLIBS += $(EXECENV_LDLIBS-y)
+
export EXECENV_CFLAGS EXECENV_LDFLAGS EXECENV_ASFLAGS EXECENV_LDLIBS
ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP)$(CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES),yy)
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lnuma
endif
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP)$(CONFIG_RTE_USE_LIBBSD),yy)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lbsd
-endif
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMBER) += -lm
_INSTALL = $(INSTALL-FILES-y) $(RTE_OUTPUT)/lib/$(LIB)
_CLEAN = doclean
+LDLIBS += $(EXECENV_LDLIBS-y)
+
.PHONY: all
all: install