dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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

      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 [PATCH 0/8] Improve build process Sergio Gonzalez Monroy
     [not found] ` <1422544811-26385-1-git-send-email-sergio.gonzalez.monroy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-29 15:20   ` [PATCH 1/8] mk: remove combined library and related options Sergio Gonzalez Monroy
2015-01-29 15:20   ` [PATCH 2/8] core: create new librte_core Sergio Gonzalez Monroy
2015-01-29 15:20   ` [PATCH 3/8] mk: new corelib makefile Sergio Gonzalez Monroy
2015-01-29 15:20   ` [PATCH 4/8] lib: update DEPDIRS variable Sergio Gonzalez Monroy
2015-01-29 15:20   ` [PATCH 5/8] lib: set LDLIBS for each library Sergio Gonzalez Monroy
2015-01-29 15:20   ` [PATCH 6/8] mk: use LDLIBS when linking shared libraries Sergio Gonzalez Monroy
2015-01-29 15:20   ` [PATCH 7/8] mk: update LDLIBS for app building Sergio Gonzalez Monroy
2015-01-29 15:20   ` [PATCH 8/8] mk: add -lpthread to linuxapp EXECENV_LDLIBS Sergio Gonzalez Monroy
2015-01-29 16:38   ` [PATCH 0/8] Improve build process Neil Horman
     [not found]     ` <20150129163859.GE1999-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-01-29 17:02       ` Thomas Monjalon
2015-01-29 17:04       ` Gonzalez Monroy, Sergio
     [not found]         ` <91383E96CE459D47BCE92EFBF5CE73B004F43D9B-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-29 19:45           ` Neil Horman
     [not found]             ` <20150129194539.GG1999-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-01-30 13:39               ` Gonzalez Monroy, Sergio
     [not found]                 ` <91383E96CE459D47BCE92EFBF5CE73B004F453D7-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-30 14:05                   ` Neil Horman
     [not found]                     ` <20150130140507.GA2664-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-01-30 17:38                       ` Gonzalez Monroy, Sergio
     [not found]                         ` <91383E96CE459D47BCE92EFBF5CE73B004F45534-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-30 18:12                           ` Neil Horman
     [not found]                             ` <20150130181249.GC2664-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-02-11 11:11                               ` Gonzalez Monroy, Sergio
     [not found]                                 ` <91383E96CE459D47BCE92EFBF5CE73B004F4AB9B-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-12  5:41                                   ` Neil Horman
     [not found]                                     ` <20150212054105.GC5504-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org>
2015-02-12  9:17                                       ` Gonzalez Monroy, Sergio
     [not found]                                         ` <54DC6FB3.8020608-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-12 12:16                                           ` Neil Horman
2015-02-12  9:22                                   ` Panu Matilainen
     [not found]                                     ` <54DC70F3.4020902-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-12 10:03                                       ` Gonzalez Monroy, Sergio
     [not found]                                         ` <54DC7A87.1090208-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-12 12:23                                           ` Neil Horman
     [not found]                                             ` <20150212122354.GB8729-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org>
2015-02-12 14:07                                               ` Panu Matilainen
     [not found]                                                 ` <54DCB3B6.1010204-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-12 15:52                                                   ` Neil Horman
     [not found]                                                     ` <20150212155225.GB4634-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org>
2015-02-13 10:14                                                       ` Panu Matilainen
     [not found]                                                         ` <54DDCE68.7090400-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-13 11:08                                                           ` Gonzalez Monroy, Sergio
     [not found]                                                             ` <54DDDB12.3090100-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-13 12:51                                                               ` Neil Horman
     [not found]                                                                 ` <20150213125142.GA11979-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org>
2015-02-20 14:31                                                                   ` Gonzalez Monroy, Sergio
     [not found]                                                                     ` <54E74548.7010805-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-22 23:37                                                                       ` Neil Horman
     [not found]                                                                         ` <20150222233740.GB31293-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org>
2015-02-23 10:25                                                                           ` Gonzalez Monroy, Sergio
     [not found]                                                                             ` <54EAFFFD.5000200-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-23 13:52                                                                               ` Neil Horman
     [not found]                                                                                 ` <20150223135205.GA19230-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-02-23 14:58                                                                                   ` Gonzalez Monroy, Sergio
     [not found]                                                                                     ` <54EB4016.1040204-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-23 18:23                                                                                       ` Neil Horman
     [not found]                                                                                         ` <20150223182319.GC19230-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-02-24 13:24                                                                                           ` Gonzalez Monroy, Sergio
2015-03-12 16:27   ` [PATCH v2 0/4] " Sergio Gonzalez Monroy
     [not found]     ` <1426177681-16931-1-git-send-email-sergio.gonzalez.monroy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-12 16:27       ` [PATCH v2 1/4] mk: Remove combined library and related options Sergio Gonzalez Monroy
     [not found]         ` <1426177681-16931-2-git-send-email-sergio.gonzalez.monroy-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-13 10:49           ` Kavanagh, Mark B
     [not found]             ` <DC5AD7FA266D86499789B1BCAEC715F846D52C87-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-13 11:19               ` Gonzalez Monroy, Sergio
     [not found]                 ` <5502C7D9.2060503-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-13 11:34                   ` Kavanagh, Mark B
     [not found]                     ` <DC5AD7FA266D86499789B1BCAEC715F846D52D13-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-13 11:48                       ` Gonzalez Monroy, Sergio
     [not found]                         ` <5502CEAB.8060801-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-13 13:16                           ` Kavanagh, Mark B
     [not found]                             ` <DC5AD7FA266D86499789B1BCAEC715F846D52DDA-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-13 14:11                               ` Gonzalez Monroy, Sergio
2015-03-13 13:17                           ` Neil Horman
     [not found]                             ` <20150313131719.GA28191-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-03-13 14:12                               ` Stefan Puiu
     [not found]                                 ` <CACKs7VAOZ-e6=jC_kUJC0eO5wfj5r3uaPOR3QGyHpzxC_vLttA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-13 15:18                                   ` Neil Horman
     [not found]                                     ` <20150313151855.GG28191-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-03-13 15:28                                       ` Gonzalez Monroy, Sergio
     [not found]                                         ` <55030200.4070505-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
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
     [not found]             ` <55096B86.7040303-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-18 12:59               ` Thomas Monjalon
2015-03-18 15:30                 ` Stefan Puiu
     [not found]                   ` <CACKs7VBNmmdPoBcv-vPpn-HVQr2Nd2Gr_2shTuqdh2L1MsfY_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-18 15:52                     ` Gonzalez Monroy, Sergio
2015-03-18 16:48                     ` Neil Horman
2015-03-26  8:52                 ` Gonzalez Monroy, Sergio
     [not found]                   ` <5513C8CD.80408-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-26 10:30                     ` Neil Horman
2015-03-18 16:41               ` Neil Horman
2015-03-12 16:27       ` [PATCH v2 2/4] lib: Set LDLIBS for each library Sergio Gonzalez Monroy
2015-03-12 16:28       ` [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-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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).