From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 4/4] mk: update LDLIBS for app building
Date: Thu, 12 Mar 2015 16:28:01 +0000 [thread overview]
Message-ID: <1426177681-16931-5-git-send-email-sergio.gonzalez.monroy@intel.com> (raw)
In-Reply-To: <1426177681-16931-1-git-send-email-sergio.gonzalez.monroy@intel.com>
Given the circular dependencies between eal, malloc, mempool and ring
libraries and that eal does not have proper DT_NEEDED entries, we work
around it by forcing linking against mentioned libraries by preceding
them with --no-as-needed flag when building shared libraries.
This patch also does:
- Set --start-group/--end-group and --whole-archive/--no-whole-archive
flags only when linking against static DPDK libs.
- Set --as-needed for all libraries but eal, malloc, mempool and
ring when linking against shared DPDK libs.
- Link against EXECENV_LIBS always with --as-needed flag.
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
lib/librte_jobstats/Makefile | 2 ++
lib/librte_pmd_fm10k/Makefile | 2 ++
lib/librte_pmd_mlx4/Makefile | 2 ++
lib/librte_pmd_null/Makefile | 2 ++
lib/librte_reorder/Makefile | 2 ++
mk/rte.app.mk | 57 +++++++++++++++++++++++--------------------
6 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 136a448..04589d4 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -41,6 +41,8 @@ EXPORT_MAP := rte_jobstats_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_JOBSTATS) := rte_jobstats.c
diff --git a/lib/librte_pmd_fm10k/Makefile b/lib/librte_pmd_fm10k/Makefile
index 998bf23..618235a 100644
--- a/lib/librte_pmd_fm10k/Makefile
+++ b/lib/librte_pmd_fm10k/Makefile
@@ -79,6 +79,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
VPATH += $(RTE_SDK)/lib/librte_pmd_fm10k/base
+LDLIBS += -lrte_eal -lrte_malloc -lethdev
+
#
# all source are stored in SRCS-y
#
diff --git a/lib/librte_pmd_mlx4/Makefile b/lib/librte_pmd_mlx4/Makefile
index 6666813..9193f05 100644
--- a/lib/librte_pmd_mlx4/Makefile
+++ b/lib/librte_pmd_mlx4/Makefile
@@ -58,6 +58,8 @@ CFLAGS += -Wno-error=cast-qual
EXPORT_MAP := rte_pmd_mlx4_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_malloc -lethdev -libverbs
+
# DEBUG which is usually provided on the command-line may enable
# CONFIG_RTE_LIBRTE_MLX4_DEBUG.
ifeq ($(DEBUG),1)
diff --git a/lib/librte_pmd_null/Makefile b/lib/librte_pmd_null/Makefile
index 6472015..c9bf1fd 100644
--- a/lib/librte_pmd_null/Makefile
+++ b/lib/librte_pmd_null/Makefile
@@ -43,6 +43,8 @@ EXPORT_MAP := rte_pmd_null_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal -lrte_malloc -lethdev -lrte_kvargs
+
#
# all source are stored in SRCS-y
#
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 0c01de1..2c8f774 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -41,6 +41,8 @@ EXPORT_MAP := rte_reorder_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal -lrte_malloc
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_REORDER) := rte_reorder.c
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e2baa49..7e225fd 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -59,7 +59,30 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
#
ifeq ($(NO_AUTOLIBS),)
-LDLIBS += --whole-archive
+LDLIBS += --no-as-needed
+ifneq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDLIBS += --start-group
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
+LDLIBS += -lrte_eal
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
+LDLIBS += -lrte_malloc
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
+LDLIBS += -lrte_mempool
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
+LDLIBS += -lrte_ring
+endif
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDLIBS += --as-needed
+endif
ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
LDLIBS += -lrte_distributor
@@ -127,15 +150,12 @@ LDLIBS += -lm
LDLIBS += -lrt
endif
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lpcap
endif
ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
+LDLIBS += -lrte_vhost
LDLIBS += -lfuse
endif
@@ -143,8 +163,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
LDLIBS += -libverbs
endif
-LDLIBS += --start-group
-
ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
LDLIBS += -lrte_kvargs
endif
@@ -161,22 +179,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
LDLIBS += -lethdev
endif
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
LDLIBS += -lrte_cmdline
endif
@@ -196,6 +198,7 @@ endif
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
# plugins (link only if static libraries)
+LDLIBS += --whole-archive
ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
LDLIBS += -lrte_pmd_vmxnet3_uio
@@ -241,14 +244,14 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y)
LDLIBS += -lrte_pmd_af_packet
endif
+LDLIBS += --no-whole-archive
+LDLIBS += --end-group
+LDLIBS += --as-needed
+
endif # plugins
LDLIBS += $(EXECENV_LDLIBS)
-LDLIBS += --end-group
-
-LDLIBS += --no-whole-archive
-
endif # ifeq ($(NO_AUTOLIBS),)
LDLIBS += $(CPU_LDLIBS)
--
1.9.3
prev parent reply other threads:[~2015-03-12 16:28 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-29 15:20 [dpdk-dev] [PATCH 0/8] Improve build process Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 1/8] mk: remove combined library and related options Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 2/8] core: create new librte_core Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 3/8] mk: new corelib makefile Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 4/8] lib: update DEPDIRS variable Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 5/8] lib: set LDLIBS for each library Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 6/8] mk: use LDLIBS when linking shared libraries Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 7/8] mk: update LDLIBS for app building Sergio Gonzalez Monroy
2015-01-29 15:20 ` [dpdk-dev] [PATCH 8/8] mk: add -lpthread to linuxapp EXECENV_LDLIBS Sergio Gonzalez Monroy
2015-01-29 16:38 ` [dpdk-dev] [PATCH 0/8] Improve build process Neil Horman
2015-01-29 17:02 ` Thomas Monjalon
2015-01-29 17:04 ` Gonzalez Monroy, Sergio
2015-01-29 19:45 ` Neil Horman
2015-01-30 13:39 ` Gonzalez Monroy, Sergio
2015-01-30 14:05 ` Neil Horman
2015-01-30 17:38 ` Gonzalez Monroy, Sergio
2015-01-30 18:12 ` Neil Horman
2015-02-11 11:11 ` Gonzalez Monroy, Sergio
2015-02-12 5:41 ` Neil Horman
2015-02-12 9:17 ` Gonzalez Monroy, Sergio
2015-02-12 12:16 ` Neil Horman
2015-02-12 9:22 ` Panu Matilainen
2015-02-12 10:03 ` Gonzalez Monroy, Sergio
2015-02-12 12:23 ` Neil Horman
2015-02-12 14:07 ` Panu Matilainen
2015-02-12 15:52 ` Neil Horman
2015-02-13 10:14 ` Panu Matilainen
2015-02-13 11:08 ` Gonzalez Monroy, Sergio
2015-02-13 12:51 ` Neil Horman
2015-02-20 14:31 ` Gonzalez Monroy, Sergio
2015-02-22 23:37 ` Neil Horman
2015-02-23 10:25 ` Gonzalez Monroy, Sergio
2015-02-23 13:52 ` Neil Horman
2015-02-23 14:58 ` Gonzalez Monroy, Sergio
2015-02-23 18:23 ` Neil Horman
2015-02-24 13:24 ` Gonzalez Monroy, Sergio
2015-03-12 16:27 ` [dpdk-dev] [PATCH v2 0/4] " Sergio Gonzalez Monroy
2015-03-12 16:27 ` [dpdk-dev] [PATCH v2 1/4] mk: Remove combined library and related options Sergio Gonzalez Monroy
2015-03-13 10:49 ` Kavanagh, Mark B
2015-03-13 11:19 ` Gonzalez Monroy, Sergio
2015-03-13 11:34 ` Kavanagh, Mark B
2015-03-13 11:48 ` Gonzalez Monroy, Sergio
2015-03-13 13:16 ` Kavanagh, Mark B
2015-03-13 14:11 ` Gonzalez Monroy, Sergio
2015-03-13 13:17 ` Neil Horman
2015-03-13 14:12 ` Stefan Puiu
2015-03-13 15:18 ` Neil Horman
2015-03-13 15:28 ` Gonzalez Monroy, Sergio
2015-03-13 16:16 ` Neil Horman
2015-03-13 16:07 ` Stephen Hemminger
2015-03-13 16:32 ` Neil Horman
2015-03-13 16:38 ` Gonzalez Monroy, Sergio
2015-03-18 12:11 ` Gonzalez Monroy, Sergio
2015-03-18 12:59 ` Thomas Monjalon
2015-03-18 15:30 ` Stefan Puiu
2015-03-18 15:52 ` Gonzalez Monroy, Sergio
2015-03-18 16:48 ` Neil Horman
2015-03-26 8:52 ` Gonzalez Monroy, Sergio
2015-03-26 10:30 ` Neil Horman
2015-03-18 16:41 ` Neil Horman
2015-03-12 16:27 ` [dpdk-dev] [PATCH v2 2/4] lib: Set LDLIBS for each library Sergio Gonzalez Monroy
2015-03-12 16:28 ` [dpdk-dev] [PATCH v2 3/4] mk: Use LDLIBS when linking shared libraries Sergio Gonzalez Monroy
2015-03-12 16:28 ` Sergio Gonzalez Monroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426177681-16931-5-git-send-email-sergio.gonzalez.monroy@intel.com \
--to=sergio.gonzalez.monroy@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).