[dpdk-dev,1/3] lib: set LDLIBS for each library

Message ID 1429090230-25137-2-git-send-email-sergio.gonzalez.monroy@intel.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Sergio Gonzalez Monroy April 15, 2015, 9:30 a.m. UTC
  This patch introduces a new LDLIBS variable to be set per library.
Its purpose is to especify the library's dependent libraries to
be explicitly linked against.

Given the circular dependencies between eal, malloc, mempool and ring,
we work around it by not linking eal against its dependent DPDK libraries.
Therefore, eal will not have proper DT_NEEDED entries (ie. no DT_NEEDED
entries for librte_malloc and librte_mempool).

This means that any application that links against eal, needs to be
certain of linking against malloc, mempool and ring too, to prevent
a case where the application does not directly use mempool (therefore
no DT_NEEDED entry). In such case, the application will fail to start as
eal does not have a DT_NEEDED entry for mempool either.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
 lib/librte_acl/Makefile              | 2 ++
 lib/librte_cfgfile/Makefile          | 2 ++
 lib/librte_cmdline/Makefile          | 2 ++
 lib/librte_distributor/Makefile      | 2 ++
 lib/librte_eal/bsdapp/eal/Makefile   | 2 ++
 lib/librte_eal/linuxapp/eal/Makefile | 2 ++
 lib/librte_ether/Makefile            | 5 ++++-
 lib/librte_hash/Makefile             | 2 ++
 lib/librte_ip_frag/Makefile          | 3 +++
 lib/librte_ivshmem/Makefile          | 2 ++
 lib/librte_jobstats/Makefile         | 2 ++
 lib/librte_kni/Makefile              | 2 ++
 lib/librte_kvargs/Makefile           | 2 ++
 lib/librte_lpm/Makefile              | 2 ++
 lib/librte_malloc/Makefile           | 2 ++
 lib/librte_mbuf/Makefile             | 2 ++
 lib/librte_mempool/Makefile          | 2 ++
 lib/librte_meter/Makefile            | 2 ++
 lib/librte_pipeline/Makefile         | 2 ++
 lib/librte_pmd_af_packet/Makefile    | 2 ++
 lib/librte_pmd_bond/Makefile         | 6 ++++++
 lib/librte_pmd_e1000/Makefile        | 2 ++
 lib/librte_pmd_enic/Makefile         | 3 +++
 lib/librte_pmd_fm10k/Makefile        | 2 ++
 lib/librte_pmd_i40e/Makefile         | 2 ++
 lib/librte_pmd_ixgbe/Makefile        | 2 ++
 lib/librte_pmd_mlx4/Makefile         | 2 ++
 lib/librte_pmd_null/Makefile         | 2 ++
 lib/librte_pmd_pcap/Makefile         | 2 ++
 lib/librte_pmd_ring/Makefile         | 4 +++-
 lib/librte_pmd_virtio/Makefile       | 2 ++
 lib/librte_pmd_vmxnet3/Makefile      | 2 ++
 lib/librte_pmd_xenvirt/Makefile      | 3 +++
 lib/librte_port/Makefile             | 4 ++++
 lib/librte_power/Makefile            | 2 ++
 lib/librte_reorder/Makefile          | 2 ++
 lib/librte_ring/Makefile             | 2 ++
 lib/librte_sched/Makefile            | 2 ++
 lib/librte_table/Makefile            | 4 ++++
 lib/librte_timer/Makefile            | 2 ++
 lib/librte_vhost/Makefile            | 7 +++++--
 41 files changed, 99 insertions(+), 4 deletions(-)
  

Comments

Olivier Matz May 4, 2015, 7:55 a.m. UTC | #1
Hi Sergio,

On 04/15/2015 11:30 AM, Sergio Gonzalez Monroy wrote:
> This patch introduces a new LDLIBS variable to be set per library.
> Its purpose is to especify the library's dependent libraries to
> be explicitly linked against.
> 
> Given the circular dependencies between eal, malloc, mempool and ring,
> we work around it by not linking eal against its dependent DPDK libraries.
> Therefore, eal will not have proper DT_NEEDED entries (ie. no DT_NEEDED
> entries for librte_malloc and librte_mempool).
> 
> This means that any application that links against eal, needs to be
> certain of linking against malloc, mempool and ring too, to prevent
> a case where the application does not directly use mempool (therefore
> no DT_NEEDED entry). In such case, the application will fail to start as
> eal does not have a DT_NEEDED entry for mempool either.
> 
> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
> ---

> [...]

> --- a/lib/librte_ip_frag/Makefile
> +++ b/lib/librte_ip_frag/Makefile
> @@ -41,6 +41,8 @@ EXPORT_MAP := rte_ipfrag_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
> +
>  #source files
>  SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv4_fragmentation.c
>  SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv6_fragmentation.c
> @@ -55,5 +57,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h
>  
>  # this library depends on rte_ether
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool lib/librte_ether
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_malloc lib/librte_mbuf
>  
>  include $(RTE_SDK)/mk/rte.lib.mk

It seems that in the rest of the patch LDLIBS and and DEPDIRS-y are
often similar, but that's not the case here. Can you confirm it's
because librte_ip_frag only uses inlined functions from librte_mempool
and librte_mbuf?

Did you use a specific scripting method to find the good value for
LDLIBS or did you do it manually? Is there a way to check that the
values are correct?


Thanks,
Olivier



> diff --git a/lib/librte_ivshmem/Makefile b/lib/librte_ivshmem/Makefile
> index 16defdb..fab6f5f 100644
> --- a/lib/librte_ivshmem/Makefile
> +++ b/lib/librte_ivshmem/Makefile
> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_ivshmem_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_mempool
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) := rte_ivshmem.c
>  
> 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_kni/Makefile b/lib/librte_kni/Makefile
> index 7107832..504ecf7 100644
> --- a/lib/librte_kni/Makefile
> +++ b/lib/librte_kni/Makefile
> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_kni_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
>  
> diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
> index 87b09f2..173e1ac 100644
> --- a/lib/librte_kvargs/Makefile
> +++ b/lib/librte_kvargs/Makefile
> @@ -42,6 +42,8 @@ EXPORT_MAP := rte_kvargs_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
>  
> diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
> index 35e6389..125d52e 100644
> --- a/lib/librte_lpm/Makefile
> +++ b/lib/librte_lpm/Makefile
> @@ -41,6 +41,8 @@ EXPORT_MAP := rte_lpm_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_LPM) := rte_lpm.c rte_lpm6.c
>  
> diff --git a/lib/librte_malloc/Makefile b/lib/librte_malloc/Makefile
> index 947e41c..3e7348f 100644
> --- a/lib/librte_malloc/Makefile
> +++ b/lib/librte_malloc/Makefile
> @@ -40,6 +40,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
>  
>  EXPORT_MAP := rte_malloc_version.map
>  
> +LDLIBS += -lrte_eal
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_MALLOC) := rte_malloc.c malloc_elem.c malloc_heap.c
>  
> diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
> index 080f3cf..d819891 100644
> --- a/lib/librte_mbuf/Makefile
> +++ b/lib/librte_mbuf/Makefile
> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_mbuf_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c
>  
> diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
> index 940d1f7..8ebebb6 100644
> --- a/lib/librte_mempool/Makefile
> +++ b/lib/librte_mempool/Makefile
> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_mempool_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc -lrte_ring
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c
>  ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
> diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
> index 8765881..d5eafb0 100644
> --- a/lib/librte_meter/Makefile
> +++ b/lib/librte_meter/Makefile
> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_meter_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
> index 15e406b..16de0a3 100644
> --- a/lib/librte_pipeline/Makefile
> +++ b/lib/librte_pipeline/Makefile
> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_pipeline_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_af_packet/Makefile b/lib/librte_pmd_af_packet/Makefile
> index f0bf537..14a9957 100644
> --- a/lib/librte_pmd_af_packet/Makefile
> +++ b/lib/librte_pmd_af_packet/Makefile
> @@ -45,6 +45,8 @@ LIBABIVER := 1
>  CFLAGS += -O3
>  CFLAGS += $(WERROR_FLAGS)
>  
> +LDLIBS += -lrte_eal -lrte_malloc -lethdev -lrte_kvargs
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile
> index 83ccce3..d046489 100644
> --- a/lib/librte_pmd_bond/Makefile
> +++ b/lib/librte_pmd_bond/Makefile
> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_eth_bond_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_mbuf -lrte_ring -lrte_mempool -lrte_malloc
> +LDLIBS += -lethdev -lrte_kvargs -lrte_cmdline
> +
>  #
>  # all source are stored in SRCS-y
>  #
> @@ -59,10 +62,13 @@ SYMLINK-y-include += rte_eth_bond.h
>  SYMLINK-y-include += rte_eth_bond_8023ad.h
>  
>  # this lib depends upon:
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_malloc
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline
>  
>  include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_pmd_e1000/Makefile b/lib/librte_pmd_e1000/Makefile
> index 8c8fed8..5af6b6a 100644
> --- a/lib/librte_pmd_e1000/Makefile
> +++ b/lib/librte_pmd_e1000/Makefile
> @@ -65,6 +65,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>  
>  VPATH += $(RTE_SDK)/lib/librte_pmd_e1000/e1000
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
> index 251a898..e0100b2 100644
> --- a/lib/librte_pmd_enic/Makefile
> +++ b/lib/librte_pmd_enic/Makefile
> @@ -48,6 +48,9 @@ CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing
>  
>  VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
> +LDLIBS += -lethdev -lrte_hash
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_fm10k/Makefile b/lib/librte_pmd_fm10k/Makefile
> index 7516d37..9ee0d48 100644
> --- a/lib/librte_pmd_fm10k/Makefile
> +++ b/lib/librte_pmd_fm10k/Makefile
> @@ -81,6 +81,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_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
> index 64bab16..fa0d858 100644
> --- a/lib/librte_pmd_i40e/Makefile
> +++ b/lib/librte_pmd_i40e/Makefile
> @@ -80,6 +80,8 @@ $(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>  
>  VPATH += $(RTE_SDK)/lib/librte_pmd_i40e/i40e
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_ixgbe/Makefile b/lib/librte_pmd_ixgbe/Makefile
> index ae36202..d96edf2 100644
> --- a/lib/librte_pmd_ixgbe/Makefile
> +++ b/lib/librte_pmd_ixgbe/Makefile
> @@ -91,6 +91,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>  
>  VPATH += $(RTE_SDK)/lib/librte_pmd_ixgbe/ixgbe
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -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 97b364a..a367748 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_pmd_pcap/Makefile b/lib/librte_pmd_pcap/Makefile
> index 0775dbc..2717978 100644
> --- a/lib/librte_pmd_pcap/Makefile
> +++ b/lib/librte_pmd_pcap/Makefile
> @@ -44,6 +44,8 @@ EXPORT_MAP := rte_pmd_pcap_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_mbuf -lrte_malloc -lethdev -lrte_kvargs -lpcap
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
> index e442d0b..33a4fb3 100644
> --- a/lib/librte_pmd_ring/Makefile
> +++ b/lib/librte_pmd_ring/Makefile
> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_eth_ring_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_ring -lrte_malloc -lethdev -lrte_kvargs
> +
>  #
>  # all source are stored in SRCS-y
>  #
> @@ -56,6 +58,6 @@ SYMLINK-y-include += rte_eth_ring.h
>  # this lib depends upon:
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
> -DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs lib/librte_malloc
>  
>  include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_pmd_virtio/Makefile b/lib/librte_pmd_virtio/Makefile
> index 21ff7e5..1ff784b 100644
> --- a/lib/librte_pmd_virtio/Makefile
> +++ b/lib/librte_pmd_virtio/Makefile
> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_pmd_virtio_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_vmxnet3/Makefile b/lib/librte_pmd_vmxnet3/Makefile
> index fc616c4..35c0c90 100644
> --- a/lib/librte_pmd_vmxnet3/Makefile
> +++ b/lib/librte_pmd_vmxnet3/Makefile
> @@ -70,6 +70,8 @@ EXPORT_MAP := rte_pmd_vmxnet3_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_pmd_xenvirt/Makefile b/lib/librte_pmd_xenvirt/Makefile
> index f0c796c..df39a6e 100644
> --- a/lib/librte_pmd_xenvirt/Makefile
> +++ b/lib/librte_pmd_xenvirt/Makefile
> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_eth_xenvirt_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
> +LDLIBS += -lethdev -rte_cmdline -xenstore
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
> index de960fc..595a682 100644
> --- a/lib/librte_port/Makefile
> +++ b/lib/librte_port/Makefile
> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_port_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_malloc
> +LDLIBS += -lethdev -lrte_ip_frag -lrte_sched
> +
>  #
>  # all source are stored in SRCS-y
>  #
> @@ -73,5 +76,6 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_malloc
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched
>  
>  include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
> index cee95cd..ec9107e 100644
> --- a/lib/librte_power/Makefile
> +++ b/lib/librte_power/Makefile
> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_power_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
>  SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
> 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/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
> index 84ad3d3..1ff6cb6 100644
> --- a/lib/librte_ring/Makefile
> +++ b/lib/librte_ring/Makefile
> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_ring_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
>  
> diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
> index b1cb285..a3ac216 100644
> --- a/lib/librte_sched/Makefile
> +++ b/lib/librte_sched/Makefile
> @@ -45,6 +45,8 @@ EXPORT_MAP := rte_sched_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_malloc
> +
>  #
>  # all source are stored in SRCS-y
>  #
> diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
> index 0d8394c..2254d52 100644
> --- a/lib/librte_table/Makefile
> +++ b/lib/librte_table/Makefile
> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_table_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
> +LDLIBS += -lrte_port -lrte_lpm -lrte_hash
> +
>  #
>  # all source are stored in SRCS-y
>  #
> @@ -80,6 +83,7 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm
>  ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl
> +LDLIBS += -lrte_acl
>  endif
>  DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash
>  
> diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
> index 2aabef8..859fa1a 100644
> --- a/lib/librte_timer/Makefile
> +++ b/lib/librte_timer/Makefile
> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_timer_version.map
>  
>  LIBABIVER := 1
>  
> +LDLIBS += -lrte_eal
> +
>  # all source are stored in SRCS-y
>  SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
>  
> diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
> index a8645a6..ac486ce 100644
> --- a/lib/librte_vhost/Makefile
> +++ b/lib/librte_vhost/Makefile
> @@ -39,11 +39,14 @@ EXPORT_MAP := rte_vhost_version.map
>  LIBABIVER := 1
>  
>  CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
> +
> +LDLIBS += -lrte_eal -lrte_mbuf -lethdev
> +
>  ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),y)
>  CFLAGS += -I vhost_user
>  else
> -CFLAGS += -I vhost_cuse -lfuse
> -LDFLAGS += -lfuse
> +CFLAGS += -I vhost_cuse
> +LDLIBS += -lfuse
>  endif
>  
>  # all source are stored in SRCS-y
>
  
Sergio Gonzalez Monroy May 5, 2015, 9:21 a.m. UTC | #2
On 04/05/2015 08:55, Olivier MATZ wrote:
> Hi Sergio,
>
> On 04/15/2015 11:30 AM, Sergio Gonzalez Monroy wrote:
>> This patch introduces a new LDLIBS variable to be set per library.
>> Its purpose is to especify the library's dependent libraries to
>> be explicitly linked against.
>>
>> Given the circular dependencies between eal, malloc, mempool and ring,
>> we work around it by not linking eal against its dependent DPDK libraries.
>> Therefore, eal will not have proper DT_NEEDED entries (ie. no DT_NEEDED
>> entries for librte_malloc and librte_mempool).
>>
>> This means that any application that links against eal, needs to be
>> certain of linking against malloc, mempool and ring too, to prevent
>> a case where the application does not directly use mempool (therefore
>> no DT_NEEDED entry). In such case, the application will fail to start as
>> eal does not have a DT_NEEDED entry for mempool either.
>>
>> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
>> ---
>> [...]
>> --- a/lib/librte_ip_frag/Makefile
>> +++ b/lib/librte_ip_frag/Makefile
>> @@ -41,6 +41,8 @@ EXPORT_MAP := rte_ipfrag_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
>> +
>>   #source files
>>   SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv4_fragmentation.c
>>   SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv6_fragmentation.c
>> @@ -55,5 +57,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h
>>   
>>   # this library depends on rte_ether
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool lib/librte_ether
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_malloc lib/librte_mbuf
>>   
>>   include $(RTE_SDK)/mk/rte.lib.mk
> It seems that in the rest of the patch LDLIBS and and DEPDIRS-y are
> often similar, but that's not the case here. Can you confirm it's
> because librte_ip_frag only uses inlined functions from librte_mempool
> and librte_mbuf?
>
I have rebased the code a few times, so I may have missed some info :)
I did try to update DEPDIRS with required info but it was all manual work.

As you menion, LDLIBS and DEPDIRS are mostly similar but in DEPDIRS we 
also specify  dirs
that would install required headers such as ether, mempool and mbuf.

By the way, I just realized that -lethdev is not required. It is not an 
issue because we link
with --as-needed so only required libs would have DT_NEEDED entries (if 
you do ldd on the
shared library you would not see a dependency for ethdev).

I could have added eal too as DEPDIRS, but it is already implicit by 
having mempool and malloc.

> Did you use a specific scripting method to find the good value for
> LDLIBS or did you do it manually? Is there a way to check that the
> values are correct?
>
I did add '-z defs' to LDLIBS (except for eal) so the linker would 
complain if any of the
symbols was not resolve at build time. With this flag we can check that 
all the required libs
are specified. If we specify libs that are not required, the linker 
would ignored them anyway.

So initially I set LDLIBS to the values of DEPDIRS, then checked that if 
some libraries were still
required, finally updating proper LDLIBS. To answer your question, I 
guess all was manual work.

My first patch did add this flag by default when linking libs but I 
removed as we decided
to leave eal without proper DT_NEEDED entries.

> Thanks,
> Olivier
>
>
I'll be sending a v2 with corrected commit for the last patch and I'll 
remove -lether from
librte_ip_frag.

Let me know if you have any other comments/suggestions.

Thanks for the review!
Sergio

>> diff --git a/lib/librte_ivshmem/Makefile b/lib/librte_ivshmem/Makefile
>> index 16defdb..fab6f5f 100644
>> --- a/lib/librte_ivshmem/Makefile
>> +++ b/lib/librte_ivshmem/Makefile
>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_ivshmem_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_mempool
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) := rte_ivshmem.c
>>   
>> 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_kni/Makefile b/lib/librte_kni/Makefile
>> index 7107832..504ecf7 100644
>> --- a/lib/librte_kni/Makefile
>> +++ b/lib/librte_kni/Makefile
>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_kni_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
>>   
>> diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
>> index 87b09f2..173e1ac 100644
>> --- a/lib/librte_kvargs/Makefile
>> +++ b/lib/librte_kvargs/Makefile
>> @@ -42,6 +42,8 @@ EXPORT_MAP := rte_kvargs_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
>>   
>> diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
>> index 35e6389..125d52e 100644
>> --- a/lib/librte_lpm/Makefile
>> +++ b/lib/librte_lpm/Makefile
>> @@ -41,6 +41,8 @@ EXPORT_MAP := rte_lpm_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_LPM) := rte_lpm.c rte_lpm6.c
>>   
>> diff --git a/lib/librte_malloc/Makefile b/lib/librte_malloc/Makefile
>> index 947e41c..3e7348f 100644
>> --- a/lib/librte_malloc/Makefile
>> +++ b/lib/librte_malloc/Makefile
>> @@ -40,6 +40,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
>>   
>>   EXPORT_MAP := rte_malloc_version.map
>>   
>> +LDLIBS += -lrte_eal
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_MALLOC) := rte_malloc.c malloc_elem.c malloc_heap.c
>>   
>> diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
>> index 080f3cf..d819891 100644
>> --- a/lib/librte_mbuf/Makefile
>> +++ b/lib/librte_mbuf/Makefile
>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_mbuf_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c
>>   
>> diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
>> index 940d1f7..8ebebb6 100644
>> --- a/lib/librte_mempool/Makefile
>> +++ b/lib/librte_mempool/Makefile
>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_mempool_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc -lrte_ring
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c
>>   ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
>> diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
>> index 8765881..d5eafb0 100644
>> --- a/lib/librte_meter/Makefile
>> +++ b/lib/librte_meter/Makefile
>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_meter_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
>> index 15e406b..16de0a3 100644
>> --- a/lib/librte_pipeline/Makefile
>> +++ b/lib/librte_pipeline/Makefile
>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_pipeline_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_af_packet/Makefile b/lib/librte_pmd_af_packet/Makefile
>> index f0bf537..14a9957 100644
>> --- a/lib/librte_pmd_af_packet/Makefile
>> +++ b/lib/librte_pmd_af_packet/Makefile
>> @@ -45,6 +45,8 @@ LIBABIVER := 1
>>   CFLAGS += -O3
>>   CFLAGS += $(WERROR_FLAGS)
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev -lrte_kvargs
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile
>> index 83ccce3..d046489 100644
>> --- a/lib/librte_pmd_bond/Makefile
>> +++ b/lib/librte_pmd_bond/Makefile
>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_eth_bond_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_mbuf -lrte_ring -lrte_mempool -lrte_malloc
>> +LDLIBS += -lethdev -lrte_kvargs -lrte_cmdline
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> @@ -59,10 +62,13 @@ SYMLINK-y-include += rte_eth_bond.h
>>   SYMLINK-y-include += rte_eth_bond_8023ad.h
>>   
>>   # this lib depends upon:
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_malloc
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline
>>   
>>   include $(RTE_SDK)/mk/rte.lib.mk
>> diff --git a/lib/librte_pmd_e1000/Makefile b/lib/librte_pmd_e1000/Makefile
>> index 8c8fed8..5af6b6a 100644
>> --- a/lib/librte_pmd_e1000/Makefile
>> +++ b/lib/librte_pmd_e1000/Makefile
>> @@ -65,6 +65,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>>   
>>   VPATH += $(RTE_SDK)/lib/librte_pmd_e1000/e1000
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
>> index 251a898..e0100b2 100644
>> --- a/lib/librte_pmd_enic/Makefile
>> +++ b/lib/librte_pmd_enic/Makefile
>> @@ -48,6 +48,9 @@ CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing
>>   
>>   VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
>> +LDLIBS += -lethdev -lrte_hash
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_fm10k/Makefile b/lib/librte_pmd_fm10k/Makefile
>> index 7516d37..9ee0d48 100644
>> --- a/lib/librte_pmd_fm10k/Makefile
>> +++ b/lib/librte_pmd_fm10k/Makefile
>> @@ -81,6 +81,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_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
>> index 64bab16..fa0d858 100644
>> --- a/lib/librte_pmd_i40e/Makefile
>> +++ b/lib/librte_pmd_i40e/Makefile
>> @@ -80,6 +80,8 @@ $(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>>   
>>   VPATH += $(RTE_SDK)/lib/librte_pmd_i40e/i40e
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_ixgbe/Makefile b/lib/librte_pmd_ixgbe/Makefile
>> index ae36202..d96edf2 100644
>> --- a/lib/librte_pmd_ixgbe/Makefile
>> +++ b/lib/librte_pmd_ixgbe/Makefile
>> @@ -91,6 +91,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>>   
>>   VPATH += $(RTE_SDK)/lib/librte_pmd_ixgbe/ixgbe
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -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 97b364a..a367748 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_pmd_pcap/Makefile b/lib/librte_pmd_pcap/Makefile
>> index 0775dbc..2717978 100644
>> --- a/lib/librte_pmd_pcap/Makefile
>> +++ b/lib/librte_pmd_pcap/Makefile
>> @@ -44,6 +44,8 @@ EXPORT_MAP := rte_pmd_pcap_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_mbuf -lrte_malloc -lethdev -lrte_kvargs -lpcap
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
>> index e442d0b..33a4fb3 100644
>> --- a/lib/librte_pmd_ring/Makefile
>> +++ b/lib/librte_pmd_ring/Makefile
>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_eth_ring_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_ring -lrte_malloc -lethdev -lrte_kvargs
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> @@ -56,6 +58,6 @@ SYMLINK-y-include += rte_eth_ring.h
>>   # this lib depends upon:
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
>> -DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs lib/librte_malloc
>>   
>>   include $(RTE_SDK)/mk/rte.lib.mk
>> diff --git a/lib/librte_pmd_virtio/Makefile b/lib/librte_pmd_virtio/Makefile
>> index 21ff7e5..1ff784b 100644
>> --- a/lib/librte_pmd_virtio/Makefile
>> +++ b/lib/librte_pmd_virtio/Makefile
>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_pmd_virtio_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_vmxnet3/Makefile b/lib/librte_pmd_vmxnet3/Makefile
>> index fc616c4..35c0c90 100644
>> --- a/lib/librte_pmd_vmxnet3/Makefile
>> +++ b/lib/librte_pmd_vmxnet3/Makefile
>> @@ -70,6 +70,8 @@ EXPORT_MAP := rte_pmd_vmxnet3_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_pmd_xenvirt/Makefile b/lib/librte_pmd_xenvirt/Makefile
>> index f0c796c..df39a6e 100644
>> --- a/lib/librte_pmd_xenvirt/Makefile
>> +++ b/lib/librte_pmd_xenvirt/Makefile
>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_eth_xenvirt_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
>> +LDLIBS += -lethdev -rte_cmdline -xenstore
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
>> index de960fc..595a682 100644
>> --- a/lib/librte_port/Makefile
>> +++ b/lib/librte_port/Makefile
>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_port_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_malloc
>> +LDLIBS += -lethdev -lrte_ip_frag -lrte_sched
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> @@ -73,5 +76,6 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_malloc
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched
>>   
>>   include $(RTE_SDK)/mk/rte.lib.mk
>> diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
>> index cee95cd..ec9107e 100644
>> --- a/lib/librte_power/Makefile
>> +++ b/lib/librte_power/Makefile
>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_power_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
>>   SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
>> 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/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
>> index 84ad3d3..1ff6cb6 100644
>> --- a/lib/librte_ring/Makefile
>> +++ b/lib/librte_ring/Makefile
>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_ring_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
>>   
>> diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
>> index b1cb285..a3ac216 100644
>> --- a/lib/librte_sched/Makefile
>> +++ b/lib/librte_sched/Makefile
>> @@ -45,6 +45,8 @@ EXPORT_MAP := rte_sched_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_malloc
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
>> index 0d8394c..2254d52 100644
>> --- a/lib/librte_table/Makefile
>> +++ b/lib/librte_table/Makefile
>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_table_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
>> +LDLIBS += -lrte_port -lrte_lpm -lrte_hash
>> +
>>   #
>>   # all source are stored in SRCS-y
>>   #
>> @@ -80,6 +83,7 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm
>>   ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl
>> +LDLIBS += -lrte_acl
>>   endif
>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash
>>   
>> diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
>> index 2aabef8..859fa1a 100644
>> --- a/lib/librte_timer/Makefile
>> +++ b/lib/librte_timer/Makefile
>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_timer_version.map
>>   
>>   LIBABIVER := 1
>>   
>> +LDLIBS += -lrte_eal
>> +
>>   # all source are stored in SRCS-y
>>   SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
>>   
>> diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
>> index a8645a6..ac486ce 100644
>> --- a/lib/librte_vhost/Makefile
>> +++ b/lib/librte_vhost/Makefile
>> @@ -39,11 +39,14 @@ EXPORT_MAP := rte_vhost_version.map
>>   LIBABIVER := 1
>>   
>>   CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
>> +
>> +LDLIBS += -lrte_eal -lrte_mbuf -lethdev
>> +
>>   ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),y)
>>   CFLAGS += -I vhost_user
>>   else
>> -CFLAGS += -I vhost_cuse -lfuse
>> -LDFLAGS += -lfuse
>> +CFLAGS += -I vhost_cuse
>> +LDLIBS += -lfuse
>>   endif
>>   
>>   # all source are stored in SRCS-y
>>
>>
>>
  
Olivier Matz May 5, 2015, 11:22 a.m. UTC | #3
Hi,

On 05/05/2015 11:21 AM, Gonzalez Monroy, Sergio wrote:
> On 04/05/2015 08:55, Olivier MATZ wrote:
>> Hi Sergio,
>>
>> On 04/15/2015 11:30 AM, Sergio Gonzalez Monroy wrote:
>>> This patch introduces a new LDLIBS variable to be set per library.
>>> Its purpose is to especify the library's dependent libraries to
>>> be explicitly linked against.
>>>
>>> Given the circular dependencies between eal, malloc, mempool and ring,
>>> we work around it by not linking eal against its dependent DPDK
>>> libraries.
>>> Therefore, eal will not have proper DT_NEEDED entries (ie. no DT_NEEDED
>>> entries for librte_malloc and librte_mempool).
>>>
>>> This means that any application that links against eal, needs to be
>>> certain of linking against malloc, mempool and ring too, to prevent
>>> a case where the application does not directly use mempool (therefore
>>> no DT_NEEDED entry). In such case, the application will fail to start as
>>> eal does not have a DT_NEEDED entry for mempool either.
>>>
>>> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
>>> ---
>>> [...]
>>> --- a/lib/librte_ip_frag/Makefile
>>> +++ b/lib/librte_ip_frag/Makefile
>>> @@ -41,6 +41,8 @@ EXPORT_MAP := rte_ipfrag_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
>>> +
>>>   #source files
>>>   SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv4_fragmentation.c
>>>   SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv6_fragmentation.c
>>> @@ -55,5 +57,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include +=
>>> rte_ip_frag.h
>>>   # this library depends on rte_ether
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool
>>> lib/librte_ether
>>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_malloc
>>> lib/librte_mbuf
>>>   include $(RTE_SDK)/mk/rte.lib.mk
>> It seems that in the rest of the patch LDLIBS and and DEPDIRS-y are
>> often similar, but that's not the case here. Can you confirm it's
>> because librte_ip_frag only uses inlined functions from librte_mempool
>> and librte_mbuf?
>>
> I have rebased the code a few times, so I may have missed some info :)
> I did try to update DEPDIRS with required info but it was all manual work.
>
> As you menion, LDLIBS and DEPDIRS are mostly similar but in DEPDIRS we
> also specify  dirs
> that would install required headers such as ether, mempool and mbuf.
>
> By the way, I just realized that -lethdev is not required. It is not an
> issue because we link
> with --as-needed so only required libs would have DT_NEEDED entries (if
> you do ldd on the
> shared library you would not see a dependency for ethdev).
>
> I could have added eal too as DEPDIRS, but it is already implicit by
> having mempool and malloc.
>
>> Did you use a specific scripting method to find the good value for
>> LDLIBS or did you do it manually? Is there a way to check that the
>> values are correct?
>>
> I did add '-z defs' to LDLIBS (except for eal) so the linker would
> complain if any of the
> symbols was not resolve at build time. With this flag we can check that
> all the required libs
> are specified. If we specify libs that are not required, the linker
> would ignored them anyway.
>
> So initially I set LDLIBS to the values of DEPDIRS, then checked that if
> some libraries were still
> required, finally updating proper LDLIBS. To answer your question, I
> guess all was manual work.
>
> My first patch did add this flag by default when linking libs but I
> removed as we decided
> to leave eal without proper DT_NEEDED entries.
>
>> Thanks,
>> Olivier
>>
>>
> I'll be sending a v2 with corrected commit for the last patch and I'll
> remove -lether from
> librte_ip_frag.
>
> Let me know if you have any other comments/suggestions.

The rest of the patch looks good to me. The commit log describes
pretty well what changes are done, but maybe adding some words
about why we need this change would be even better, as the cover letter
won't appear in git history.

Regards,
Olivier



>
> Thanks for the review!
> Sergio
>
>>> diff --git a/lib/librte_ivshmem/Makefile b/lib/librte_ivshmem/Makefile
>>> index 16defdb..fab6f5f 100644
>>> --- a/lib/librte_ivshmem/Makefile
>>> +++ b/lib/librte_ivshmem/Makefile
>>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_ivshmem_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_mempool
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) := rte_ivshmem.c
>>> 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_kni/Makefile b/lib/librte_kni/Makefile
>>> index 7107832..504ecf7 100644
>>> --- a/lib/librte_kni/Makefile
>>> +++ b/lib/librte_kni/Makefile
>>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_kni_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
>>> diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
>>> index 87b09f2..173e1ac 100644
>>> --- a/lib/librte_kvargs/Makefile
>>> +++ b/lib/librte_kvargs/Makefile
>>> @@ -42,6 +42,8 @@ EXPORT_MAP := rte_kvargs_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
>>> diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
>>> index 35e6389..125d52e 100644
>>> --- a/lib/librte_lpm/Makefile
>>> +++ b/lib/librte_lpm/Makefile
>>> @@ -41,6 +41,8 @@ EXPORT_MAP := rte_lpm_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_LPM) := rte_lpm.c rte_lpm6.c
>>> diff --git a/lib/librte_malloc/Makefile b/lib/librte_malloc/Makefile
>>> index 947e41c..3e7348f 100644
>>> --- a/lib/librte_malloc/Makefile
>>> +++ b/lib/librte_malloc/Makefile
>>> @@ -40,6 +40,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
>>>   EXPORT_MAP := rte_malloc_version.map
>>> +LDLIBS += -lrte_eal
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_MALLOC) := rte_malloc.c malloc_elem.c
>>> malloc_heap.c
>>> diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
>>> index 080f3cf..d819891 100644
>>> --- a/lib/librte_mbuf/Makefile
>>> +++ b/lib/librte_mbuf/Makefile
>>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_mbuf_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c
>>> diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
>>> index 940d1f7..8ebebb6 100644
>>> --- a/lib/librte_mempool/Makefile
>>> +++ b/lib/librte_mempool/Makefile
>>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_mempool_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc -lrte_ring
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c
>>>   ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
>>> diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
>>> index 8765881..d5eafb0 100644
>>> --- a/lib/librte_meter/Makefile
>>> +++ b/lib/librte_meter/Makefile
>>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_meter_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
>>> index 15e406b..16de0a3 100644
>>> --- a/lib/librte_pipeline/Makefile
>>> +++ b/lib/librte_pipeline/Makefile
>>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_pipeline_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_af_packet/Makefile
>>> b/lib/librte_pmd_af_packet/Makefile
>>> index f0bf537..14a9957 100644
>>> --- a/lib/librte_pmd_af_packet/Makefile
>>> +++ b/lib/librte_pmd_af_packet/Makefile
>>> @@ -45,6 +45,8 @@ LIBABIVER := 1
>>>   CFLAGS += -O3
>>>   CFLAGS += $(WERROR_FLAGS)
>>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev -lrte_kvargs
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile
>>> index 83ccce3..d046489 100644
>>> --- a/lib/librte_pmd_bond/Makefile
>>> +++ b/lib/librte_pmd_bond/Makefile
>>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_eth_bond_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_mbuf -lrte_ring -lrte_mempool -lrte_malloc
>>> +LDLIBS += -lethdev -lrte_kvargs -lrte_cmdline
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> @@ -59,10 +62,13 @@ SYMLINK-y-include += rte_eth_bond.h
>>>   SYMLINK-y-include += rte_eth_bond_8023ad.h
>>>   # this lib depends upon:
>>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring
>>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_malloc
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
>>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline
>>>   include $(RTE_SDK)/mk/rte.lib.mk
>>> diff --git a/lib/librte_pmd_e1000/Makefile
>>> b/lib/librte_pmd_e1000/Makefile
>>> index 8c8fed8..5af6b6a 100644
>>> --- a/lib/librte_pmd_e1000/Makefile
>>> +++ b/lib/librte_pmd_e1000/Makefile
>>> @@ -65,6 +65,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval
>>> CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>>>   VPATH += $(RTE_SDK)/lib/librte_pmd_e1000/e1000
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
>>> index 251a898..e0100b2 100644
>>> --- a/lib/librte_pmd_enic/Makefile
>>> +++ b/lib/librte_pmd_enic/Makefile
>>> @@ -48,6 +48,9 @@ CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing
>>>   VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
>>> +LDLIBS += -lethdev -lrte_hash
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_fm10k/Makefile
>>> b/lib/librte_pmd_fm10k/Makefile
>>> index 7516d37..9ee0d48 100644
>>> --- a/lib/librte_pmd_fm10k/Makefile
>>> +++ b/lib/librte_pmd_fm10k/Makefile
>>> @@ -81,6 +81,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_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
>>> index 64bab16..fa0d858 100644
>>> --- a/lib/librte_pmd_i40e/Makefile
>>> +++ b/lib/librte_pmd_i40e/Makefile
>>> @@ -80,6 +80,8 @@ $(foreach obj, $(OBJS_BASE_DRIVER), $(eval
>>> CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>>>   VPATH += $(RTE_SDK)/lib/librte_pmd_i40e/i40e
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_ixgbe/Makefile
>>> b/lib/librte_pmd_ixgbe/Makefile
>>> index ae36202..d96edf2 100644
>>> --- a/lib/librte_pmd_ixgbe/Makefile
>>> +++ b/lib/librte_pmd_ixgbe/Makefile
>>> @@ -91,6 +91,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval
>>> CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
>>>   VPATH += $(RTE_SDK)/lib/librte_pmd_ixgbe/ixgbe
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -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 97b364a..a367748 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_pmd_pcap/Makefile b/lib/librte_pmd_pcap/Makefile
>>> index 0775dbc..2717978 100644
>>> --- a/lib/librte_pmd_pcap/Makefile
>>> +++ b/lib/librte_pmd_pcap/Makefile
>>> @@ -44,6 +44,8 @@ EXPORT_MAP := rte_pmd_pcap_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_mbuf -lrte_malloc -lethdev -lrte_kvargs -lpcap
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
>>> index e442d0b..33a4fb3 100644
>>> --- a/lib/librte_pmd_ring/Makefile
>>> +++ b/lib/librte_pmd_ring/Makefile
>>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_eth_ring_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_ring -lrte_malloc -lethdev -lrte_kvargs
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> @@ -56,6 +58,6 @@ SYMLINK-y-include += rte_eth_ring.h
>>>   # this lib depends upon:
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal
>>> lib/librte_ring
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf
>>> lib/librte_ether
>>> -DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
>>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
>>> lib/librte_malloc
>>>   include $(RTE_SDK)/mk/rte.lib.mk
>>> diff --git a/lib/librte_pmd_virtio/Makefile
>>> b/lib/librte_pmd_virtio/Makefile
>>> index 21ff7e5..1ff784b 100644
>>> --- a/lib/librte_pmd_virtio/Makefile
>>> +++ b/lib/librte_pmd_virtio/Makefile
>>> @@ -43,6 +43,8 @@ EXPORT_MAP := rte_pmd_virtio_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc -lethdev
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_vmxnet3/Makefile
>>> b/lib/librte_pmd_vmxnet3/Makefile
>>> index fc616c4..35c0c90 100644
>>> --- a/lib/librte_pmd_vmxnet3/Makefile
>>> +++ b/lib/librte_pmd_vmxnet3/Makefile
>>> @@ -70,6 +70,8 @@ EXPORT_MAP := rte_pmd_vmxnet3_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_pmd_xenvirt/Makefile
>>> b/lib/librte_pmd_xenvirt/Makefile
>>> index f0c796c..df39a6e 100644
>>> --- a/lib/librte_pmd_xenvirt/Makefile
>>> +++ b/lib/librte_pmd_xenvirt/Makefile
>>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_eth_xenvirt_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
>>> +LDLIBS += -lethdev -rte_cmdline -xenstore
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
>>> index de960fc..595a682 100644
>>> --- a/lib/librte_port/Makefile
>>> +++ b/lib/librte_port/Makefile
>>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_port_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_malloc
>>> +LDLIBS += -lethdev -lrte_ip_frag -lrte_sched
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> @@ -73,5 +76,6 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) +=
>>> lib/librte_mempool
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_malloc
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag
>>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched
>>>   include $(RTE_SDK)/mk/rte.lib.mk
>>> diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
>>> index cee95cd..ec9107e 100644
>>> --- a/lib/librte_power/Makefile
>>> +++ b/lib/librte_power/Makefile
>>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_power_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c
>>> rte_power_acpi_cpufreq.c
>>>   SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
>>> 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/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
>>> index 84ad3d3..1ff6cb6 100644
>>> --- a/lib/librte_ring/Makefile
>>> +++ b/lib/librte_ring/Makefile
>>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_ring_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
>>> diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
>>> index b1cb285..a3ac216 100644
>>> --- a/lib/librte_sched/Makefile
>>> +++ b/lib/librte_sched/Makefile
>>> @@ -45,6 +45,8 @@ EXPORT_MAP := rte_sched_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_malloc
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
>>> index 0d8394c..2254d52 100644
>>> --- a/lib/librte_table/Makefile
>>> +++ b/lib/librte_table/Makefile
>>> @@ -43,6 +43,9 @@ EXPORT_MAP := rte_table_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
>>> +LDLIBS += -lrte_port -lrte_lpm -lrte_hash
>>> +
>>>   #
>>>   # all source are stored in SRCS-y
>>>   #
>>> @@ -80,6 +83,7 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm
>>>   ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl
>>> +LDLIBS += -lrte_acl
>>>   endif
>>>   DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash
>>> diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
>>> index 2aabef8..859fa1a 100644
>>> --- a/lib/librte_timer/Makefile
>>> +++ b/lib/librte_timer/Makefile
>>> @@ -40,6 +40,8 @@ EXPORT_MAP := rte_timer_version.map
>>>   LIBABIVER := 1
>>> +LDLIBS += -lrte_eal
>>> +
>>>   # all source are stored in SRCS-y
>>>   SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
>>> diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
>>> index a8645a6..ac486ce 100644
>>> --- a/lib/librte_vhost/Makefile
>>> +++ b/lib/librte_vhost/Makefile
>>> @@ -39,11 +39,14 @@ EXPORT_MAP := rte_vhost_version.map
>>>   LIBABIVER := 1
>>>   CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
>>> +
>>> +LDLIBS += -lrte_eal -lrte_mbuf -lethdev
>>> +
>>>   ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),y)
>>>   CFLAGS += -I vhost_user
>>>   else
>>> -CFLAGS += -I vhost_cuse -lfuse
>>> -LDFLAGS += -lfuse
>>> +CFLAGS += -I vhost_cuse
>>> +LDLIBS += -lfuse
>>>   endif
>>>   # all source are stored in SRCS-y
>>>
>>>
>>>
>
>
  

Patch

diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 68dc248..00f5e33 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -41,6 +41,8 @@  EXPORT_MAP := rte_acl_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += tb_mem.c
 
diff --git a/lib/librte_cfgfile/Makefile b/lib/librte_cfgfile/Makefile
index 032c240..babe7d1 100644
--- a/lib/librte_cfgfile/Makefile
+++ b/lib/librte_cfgfile/Makefile
@@ -43,6 +43,8 @@  EXPORT_MAP := rte_cfgfile_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 719dff6..0f7935f 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_cmdline_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := cmdline.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_cirbuf.c
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index 4c9af17..b275491 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -41,6 +41,8 @@  EXPORT_MAP := rte_distributor_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_mbuf
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor.c
 
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 2357cfa..8d7a6fc 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -46,6 +46,8 @@  CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_ring
 CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_pcap
 CFLAGS += $(WERROR_FLAGS) -O3
 
+LDLIBS += -lrt
+
 EXPORT_MAP := rte_eal_version.map
 
 LIBABIVER := 1
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 01f7b70..c351a38 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -53,6 +53,8 @@  CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_af_packet
 CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_xenvirt
 CFLAGS += $(WERROR_FLAGS) -O3
 
+LDLIBS += -lrt
+
 # specific to linuxapp exec-env
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) := eal.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_hugepage_info.c
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index c0e5768..a1059d7 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -43,6 +43,8 @@  EXPORT_MAP := rte_ether_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_malloc
+
 SRCS-y += rte_ethdev.c
 
 #
@@ -53,6 +55,7 @@  SYMLINK-y-include += rte_ethdev.h
 SYMLINK-y-include += rte_eth_ctrl.h
 
 # this lib depends upon:
-DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf
+DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring
+DEPDIRS-y += lib/librte_mbuf lib/librte_malloc
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index 3696cb1..bc9bfc7 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -41,6 +41,8 @@  EXPORT_MAP := rte_hash_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_HASH) := rte_hash.c
 SRCS-$(CONFIG_RTE_LIBRTE_HASH) += rte_fbk_hash.c
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 9d06780..ee72ab4 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -41,6 +41,8 @@  EXPORT_MAP := rte_ipfrag_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc -lethdev
+
 #source files
 SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv4_fragmentation.c
 SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv6_fragmentation.c
@@ -55,5 +57,6 @@  SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h
 
 # this library depends on rte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_malloc lib/librte_mbuf
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ivshmem/Makefile b/lib/librte_ivshmem/Makefile
index 16defdb..fab6f5f 100644
--- a/lib/librte_ivshmem/Makefile
+++ b/lib/librte_ivshmem/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_ivshmem_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_mempool
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) := rte_ivshmem.c
 
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_kni/Makefile b/lib/librte_kni/Makefile
index 7107832..504ecf7 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_kni_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc -lethdev
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
 
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 87b09f2..173e1ac 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -42,6 +42,8 @@  EXPORT_MAP := rte_kvargs_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
 
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 35e6389..125d52e 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -41,6 +41,8 @@  EXPORT_MAP := rte_lpm_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_LPM) := rte_lpm.c rte_lpm6.c
 
diff --git a/lib/librte_malloc/Makefile b/lib/librte_malloc/Makefile
index 947e41c..3e7348f 100644
--- a/lib/librte_malloc/Makefile
+++ b/lib/librte_malloc/Makefile
@@ -40,6 +40,8 @@  CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
 
 EXPORT_MAP := rte_malloc_version.map
 
+LDLIBS += -lrte_eal
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_MALLOC) := rte_malloc.c malloc_elem.c malloc_heap.c
 
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 080f3cf..d819891 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_mbuf_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c
 
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 940d1f7..8ebebb6 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_mempool_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc -lrte_ring
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c
 ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
index 8765881..d5eafb0 100644
--- a/lib/librte_meter/Makefile
+++ b/lib/librte_meter/Makefile
@@ -43,6 +43,8 @@  EXPORT_MAP := rte_meter_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
index 15e406b..16de0a3 100644
--- a/lib/librte_pipeline/Makefile
+++ b/lib/librte_pipeline/Makefile
@@ -43,6 +43,8 @@  EXPORT_MAP := rte_pipeline_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_af_packet/Makefile b/lib/librte_pmd_af_packet/Makefile
index f0bf537..14a9957 100644
--- a/lib/librte_pmd_af_packet/Makefile
+++ b/lib/librte_pmd_af_packet/Makefile
@@ -45,6 +45,8 @@  LIBABIVER := 1
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
+LDLIBS += -lrte_eal -lrte_malloc -lethdev -lrte_kvargs
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile
index 83ccce3..d046489 100644
--- a/lib/librte_pmd_bond/Makefile
+++ b/lib/librte_pmd_bond/Makefile
@@ -43,6 +43,9 @@  EXPORT_MAP := rte_eth_bond_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_ring -lrte_mempool -lrte_malloc
+LDLIBS += -lethdev -lrte_kvargs -lrte_cmdline
+
 #
 # all source are stored in SRCS-y
 #
@@ -59,10 +62,13 @@  SYMLINK-y-include += rte_eth_bond.h
 SYMLINK-y-include += rte_eth_bond_8023ad.h
 
 # this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_malloc
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_e1000/Makefile b/lib/librte_pmd_e1000/Makefile
index 8c8fed8..5af6b6a 100644
--- a/lib/librte_pmd_e1000/Makefile
+++ b/lib/librte_pmd_e1000/Makefile
@@ -65,6 +65,8 @@  $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
 
 VPATH += $(RTE_SDK)/lib/librte_pmd_e1000/e1000
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
index 251a898..e0100b2 100644
--- a/lib/librte_pmd_enic/Makefile
+++ b/lib/librte_pmd_enic/Makefile
@@ -48,6 +48,9 @@  CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing
 
 VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
+LDLIBS += -lethdev -lrte_hash
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_fm10k/Makefile b/lib/librte_pmd_fm10k/Makefile
index 7516d37..9ee0d48 100644
--- a/lib/librte_pmd_fm10k/Makefile
+++ b/lib/librte_pmd_fm10k/Makefile
@@ -81,6 +81,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_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
index 64bab16..fa0d858 100644
--- a/lib/librte_pmd_i40e/Makefile
+++ b/lib/librte_pmd_i40e/Makefile
@@ -80,6 +80,8 @@  $(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
 
 VPATH += $(RTE_SDK)/lib/librte_pmd_i40e/i40e
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_ixgbe/Makefile b/lib/librte_pmd_ixgbe/Makefile
index ae36202..d96edf2 100644
--- a/lib/librte_pmd_ixgbe/Makefile
+++ b/lib/librte_pmd_ixgbe/Makefile
@@ -91,6 +91,8 @@  $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
 
 VPATH += $(RTE_SDK)/lib/librte_pmd_ixgbe/ixgbe
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -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 97b364a..a367748 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_pmd_pcap/Makefile b/lib/librte_pmd_pcap/Makefile
index 0775dbc..2717978 100644
--- a/lib/librte_pmd_pcap/Makefile
+++ b/lib/librte_pmd_pcap/Makefile
@@ -44,6 +44,8 @@  EXPORT_MAP := rte_pmd_pcap_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_mbuf -lrte_malloc -lethdev -lrte_kvargs -lpcap
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_ring/Makefile b/lib/librte_pmd_ring/Makefile
index e442d0b..33a4fb3 100644
--- a/lib/librte_pmd_ring/Makefile
+++ b/lib/librte_pmd_ring/Makefile
@@ -43,6 +43,8 @@  EXPORT_MAP := rte_eth_ring_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_ring -lrte_malloc -lethdev -lrte_kvargs
+
 #
 # all source are stored in SRCS-y
 #
@@ -56,6 +58,6 @@  SYMLINK-y-include += rte_eth_ring.h
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs lib/librte_malloc
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_virtio/Makefile b/lib/librte_pmd_virtio/Makefile
index 21ff7e5..1ff784b 100644
--- a/lib/librte_pmd_virtio/Makefile
+++ b/lib/librte_pmd_virtio/Makefile
@@ -43,6 +43,8 @@  EXPORT_MAP := rte_pmd_virtio_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc -lethdev
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_vmxnet3/Makefile b/lib/librte_pmd_vmxnet3/Makefile
index fc616c4..35c0c90 100644
--- a/lib/librte_pmd_vmxnet3/Makefile
+++ b/lib/librte_pmd_vmxnet3/Makefile
@@ -70,6 +70,8 @@  EXPORT_MAP := rte_pmd_vmxnet3_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc -lethdev
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_pmd_xenvirt/Makefile b/lib/librte_pmd_xenvirt/Makefile
index f0c796c..df39a6e 100644
--- a/lib/librte_pmd_xenvirt/Makefile
+++ b/lib/librte_pmd_xenvirt/Makefile
@@ -43,6 +43,9 @@  EXPORT_MAP := rte_eth_xenvirt_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
+LDLIBS += -lethdev -rte_cmdline -xenstore
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
index de960fc..595a682 100644
--- a/lib/librte_port/Makefile
+++ b/lib/librte_port/Makefile
@@ -43,6 +43,9 @@  EXPORT_MAP := rte_port_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_malloc
+LDLIBS += -lethdev -lrte_ip_frag -lrte_sched
+
 #
 # all source are stored in SRCS-y
 #
@@ -73,5 +76,6 @@  DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_malloc
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index cee95cd..ec9107e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_power_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
 SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
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/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 84ad3d3..1ff6cb6 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_ring_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
 
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index b1cb285..a3ac216 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -45,6 +45,8 @@  EXPORT_MAP := rte_sched_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_malloc
+
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
index 0d8394c..2254d52 100644
--- a/lib/librte_table/Makefile
+++ b/lib/librte_table/Makefile
@@ -43,6 +43,9 @@  EXPORT_MAP := rte_table_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_malloc
+LDLIBS += -lrte_port -lrte_lpm -lrte_hash
+
 #
 # all source are stored in SRCS-y
 #
@@ -80,6 +83,7 @@  DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port
 DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm
 ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
 DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl
+LDLIBS += -lrte_acl
 endif
 DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash
 
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 2aabef8..859fa1a 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -40,6 +40,8 @@  EXPORT_MAP := rte_timer_version.map
 
 LIBABIVER := 1
 
+LDLIBS += -lrte_eal
+
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
 
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index a8645a6..ac486ce 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -39,11 +39,14 @@  EXPORT_MAP := rte_vhost_version.map
 LIBABIVER := 1
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
+
+LDLIBS += -lrte_eal -lrte_mbuf -lethdev
+
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),y)
 CFLAGS += -I vhost_user
 else
-CFLAGS += -I vhost_cuse -lfuse
-LDFLAGS += -lfuse
+CFLAGS += -I vhost_cuse
+LDLIBS += -lfuse
 endif
 
 # all source are stored in SRCS-y