All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: fix shared library dependencies to external libraries
@ 2015-10-21 14:18 Panu Matilainen
  2015-10-21 16:30 ` Nicolas Pernas Maradei
  2015-12-06 18:46 ` [PATCH v2 1/2] mk: prepare dependencies in shared libraries not combined Thomas Monjalon
  0 siblings, 2 replies; 6+ messages in thread
From: Panu Matilainen @ 2015-10-21 14:18 UTC (permalink / raw)
  To: dev; +Cc: nicolas.pernas.maradei

Similar to commit 113c8e13c4201eee207723571f83aaf285277d75, but
for bnx2x and pcap PMDs.

Requiring applications to know about library internal details like
dependencies to external helper libraries is a limitation of
static linkage, shared libraries should always know their own
dependencies for sane operation. This is especially highlighted
with dlopen()'ed items, having applications link against about plugin
internal dependencies goes on the side of absurd.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
 drivers/net/bnx2x/Makefile | 1 +
 drivers/net/pcap/Makefile  | 1 +
 mk/rte.app.mk              | 5 ++---
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
index 87f31b6..d895d8c 100644
--- a/drivers/net/bnx2x/Makefile
+++ b/drivers/net/bnx2x/Makefile
@@ -8,6 +8,7 @@ LIB = librte_pmd_bnx2x.a
 CFLAGS += -O3 -g
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -DZLIB_CONST
+LDLIBS += -lz
 
 EXPORT_MAP := rte_pmd_bnx2x_version.map
 
diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
index 48be913..b41d8a2 100644
--- a/drivers/net/pcap/Makefile
+++ b/drivers/net/pcap/Makefile
@@ -39,6 +39,7 @@ LIB = librte_pmd_pcap.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lpcap
 
 EXPORT_MAP := rte_pmd_pcap_version.map
 
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 9e1909e..c0d574f 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -90,7 +90,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lrte_vhost
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
 
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lpcap
 
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lnuma
@@ -101,11 +100,11 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lfuse
 endif
 
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lpcap
+_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -libverbs
 endif # ! CONFIG_RTE_BUILD_SHARED_LIBS
 
-_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
-
 _LDLIBS-y += --start-group
 
 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drivers: fix shared library dependencies to external libraries
  2015-10-21 14:18 [PATCH] drivers: fix shared library dependencies to external libraries Panu Matilainen
@ 2015-10-21 16:30 ` Nicolas Pernas Maradei
  2015-10-22  4:44   ` Panu Matilainen
  2015-12-06 18:46 ` [PATCH v2 1/2] mk: prepare dependencies in shared libraries not combined Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Pernas Maradei @ 2015-10-21 16:30 UTC (permalink / raw)
  To: Panu Matilainen, dev

Hi,

Are those the only two libraries with external dependencies? I took a 
quick look to the rte.app.mk file and there seem to be some others like 
-lfuse and -lnuma. Would it be possible to move those to their specific 
Makefiles as well?

Thanks,
Nico.

On 10/21/2015 03:18 PM, Panu Matilainen wrote:
> Similar to commit 113c8e13c4201eee207723571f83aaf285277d75, but
> for bnx2x and pcap PMDs.
>
> Requiring applications to know about library internal details like
> dependencies to external helper libraries is a limitation of
> static linkage, shared libraries should always know their own
> dependencies for sane operation. This is especially highlighted
> with dlopen()'ed items, having applications link against about plugin
> internal dependencies goes on the side of absurd.
>
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
> ---
>   drivers/net/bnx2x/Makefile | 1 +
>   drivers/net/pcap/Makefile  | 1 +
>   mk/rte.app.mk              | 5 ++---
>   3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
> index 87f31b6..d895d8c 100644
> --- a/drivers/net/bnx2x/Makefile
> +++ b/drivers/net/bnx2x/Makefile
> @@ -8,6 +8,7 @@ LIB = librte_pmd_bnx2x.a
>   CFLAGS += -O3 -g
>   CFLAGS += $(WERROR_FLAGS)
>   CFLAGS += -DZLIB_CONST
> +LDLIBS += -lz
>   
>   EXPORT_MAP := rte_pmd_bnx2x_version.map
>   
> diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
> index 48be913..b41d8a2 100644
> --- a/drivers/net/pcap/Makefile
> +++ b/drivers/net/pcap/Makefile
> @@ -39,6 +39,7 @@ LIB = librte_pmd_pcap.a
>   
>   CFLAGS += -O3
>   CFLAGS += $(WERROR_FLAGS)
> +LDLIBS += -lpcap
>   
>   EXPORT_MAP := rte_pmd_pcap_version.map
>   
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index 9e1909e..c0d574f 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -90,7 +90,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lrte_vhost
>   
>   endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
>   
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lpcap
>   
>   ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
>   _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lnuma
> @@ -101,11 +100,11 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lfuse
>   endif
>   
>   ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lpcap
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
>   _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -libverbs
>   endif # ! CONFIG_RTE_BUILD_SHARED_LIBS
>   
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
> -
>   _LDLIBS-y += --start-group
>   
>   ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drivers: fix shared library dependencies to external libraries
  2015-10-21 16:30 ` Nicolas Pernas Maradei
@ 2015-10-22  4:44   ` Panu Matilainen
  0 siblings, 0 replies; 6+ messages in thread
From: Panu Matilainen @ 2015-10-22  4:44 UTC (permalink / raw)
  To: Nicolas Pernas Maradei, dev

On 10/21/2015 07:30 PM, Nicolas Pernas Maradei wrote:
> Hi,
>
> Are those the only two libraries with external dependencies? I took a
> quick look to the rte.app.mk file and there seem to be some others like
> -lfuse and -lnuma. Would it be possible to move those to their specific
> Makefiles as well?

AFAICS those were only remaining *drivers* with external dependencies.

The libraries have dependencies of their own like you noted, but they're 
more scattered, and things start getting more complicated because of 
CONFIG_RTE_BUILD_COMBINE_LIBS etc. I plan to get to that later when time 
permits but wanted to get the driver side out of the way because they're 
the worst offenders, and one driver already does this so the situation 
is inconsistent too.

	- Panu -

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] mk: prepare dependencies in shared libraries not combined
  2015-10-21 14:18 [PATCH] drivers: fix shared library dependencies to external libraries Panu Matilainen
  2015-10-21 16:30 ` Nicolas Pernas Maradei
@ 2015-12-06 18:46 ` Thomas Monjalon
  2015-12-06 18:46   ` [PATCH v2 2/2] mk: fix shared library dependencies of drivers Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2015-12-06 18:46 UTC (permalink / raw)
  To: Panu Matilainen; +Cc: dev

Some DPDK libraries have a dependency.
The Mellanox drivers embed this declaration in shared library case.
So the application do not need to know the dependency when linking.
But it cannot work with static libraries or the combined one.
Note that Mellanox drivers are currently not supported in a shared
combined library case.

Most of the DPDK libraries declare their dependencies to be linked
with the application in every cases, even when using drivers as
shared library plugins.
This patch improves the condition used for Mellanox drivers, so that
it can be applied to other drivers without breaking the shared
combined library case.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 mk/rte.app.mk | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index d7e2964..3f56852 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -102,13 +102,13 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lfuse
 endif
 
-ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+# The static libraries do not know their dependencies.
+# The combined library fails also to store this information.
+# So linking with static or combined library requires explicit dependencies.
+ifneq ($(CONFIG_RTE_BUILD_COMBINE_LIBS)$(CONFIG_RTE_BUILD_SHARED_LIB),ny)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -libverbs
-endif # ! CONFIG_RTE_BUILD_SHARED_LIBS
-
-ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD)       += -libverbs
-endif # ! CONFIG_RTE_BUILD_SHARED_LIBS
+endif # CONFIG_RTE_BUILD_COMBINE_LIBS or not CONFIG_RTE_BUILD_SHARED_LIBS
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
 
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] mk: fix shared library dependencies of drivers
  2015-12-06 18:46 ` [PATCH v2 1/2] mk: prepare dependencies in shared libraries not combined Thomas Monjalon
@ 2015-12-06 18:46   ` Thomas Monjalon
  2015-12-06 21:13     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2015-12-06 18:46 UTC (permalink / raw)
  To: Panu Matilainen; +Cc: dev

From: Panu Matilainen <pmatilai@redhat.com>

Similar to commit 113c8e13c4201eee207723571f83aaf285277d75, but
for bnx2x, pcap, sze2data and xenvirt PMDs.

Requiring applications to know about library internal details like
dependencies to external helper libraries is a limitation of
static linkage, shared libraries should always know their own
dependencies for sane operation. This is especially highlighted
with dlopen()'ed items, having applications link against about plugin
internal dependencies goes on the side of absurd.

Note that linking with a shared combined library still requires to
know the internal dependencies.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 drivers/net/bnx2x/Makefile    |  1 +
 drivers/net/pcap/Makefile     |  1 +
 drivers/net/szedata2/Makefile |  1 +
 drivers/net/xenvirt/Makefile  |  1 +
 mk/rte.app.mk                 | 12 ++++--------
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
index 87f31b6..d895d8c 100644
--- a/drivers/net/bnx2x/Makefile
+++ b/drivers/net/bnx2x/Makefile
@@ -8,6 +8,7 @@ LIB = librte_pmd_bnx2x.a
 CFLAGS += -O3 -g
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -DZLIB_CONST
+LDLIBS += -lz
 
 EXPORT_MAP := rte_pmd_bnx2x_version.map
 
diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
index 48be913..b41d8a2 100644
--- a/drivers/net/pcap/Makefile
+++ b/drivers/net/pcap/Makefile
@@ -39,6 +39,7 @@ LIB = librte_pmd_pcap.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lpcap
 
 EXPORT_MAP := rte_pmd_pcap_version.map
 
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index c3c42e5..963a8d6 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -38,6 +38,7 @@ LIB = librte_pmd_szedata2.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lsze2
 
 EXPORT_MAP := rte_pmd_szedata2_version.map
 
diff --git a/drivers/net/xenvirt/Makefile b/drivers/net/xenvirt/Makefile
index 9c521d5..1d05b71 100644
--- a/drivers/net/xenvirt/Makefile
+++ b/drivers/net/xenvirt/Makefile
@@ -38,6 +38,7 @@ LIB = librte_pmd_xenvirt.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lxenstore
 
 EXPORT_MAP := rte_eth_xenvirt_version.map
 
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 3f56852..90ec33d 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -90,10 +90,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lrte_vhost
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
 
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lpcap
-
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2)   += -lsze2
-
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lnuma
 endif
@@ -106,13 +102,13 @@ endif
 # The combined library fails also to store this information.
 # So linking with static or combined library requires explicit dependencies.
 ifneq ($(CONFIG_RTE_BUILD_COMBINE_LIBS)$(CONFIG_RTE_BUILD_SHARED_LIB),ny)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lpcap
+_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -libverbs
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD)       += -libverbs
-endif # CONFIG_RTE_BUILD_COMBINE_LIBS or not CONFIG_RTE_BUILD_SHARED_LIBS
-
-_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
-
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2)   += -lsze2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)    += -lxenstore
+endif # CONFIG_RTE_BUILD_COMBINE_LIBS or not CONFIG_RTE_BUILD_SHARED_LIBS
 
 _LDLIBS-y += --start-group
 
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] mk: fix shared library dependencies of drivers
  2015-12-06 18:46   ` [PATCH v2 2/2] mk: fix shared library dependencies of drivers Thomas Monjalon
@ 2015-12-06 21:13     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2015-12-06 21:13 UTC (permalink / raw)
  To: Panu Matilainen; +Cc: dev

2015-12-06 19:46, Thomas Monjalon:
> From: Panu Matilainen <pmatilai@redhat.com>
> 
> Similar to commit 113c8e13c4201eee207723571f83aaf285277d75, but
> for bnx2x, pcap, sze2data and xenvirt PMDs.
> 
> Requiring applications to know about library internal details like
> dependencies to external helper libraries is a limitation of
> static linkage, shared libraries should always know their own
> dependencies for sane operation. This is especially highlighted
> with dlopen()'ed items, having applications link against about plugin
> internal dependencies goes on the side of absurd.
> 
> Note that linking with a shared combined library still requires to
> know the internal dependencies.
> 
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied shortly for RC3 preparation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-06 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-21 14:18 [PATCH] drivers: fix shared library dependencies to external libraries Panu Matilainen
2015-10-21 16:30 ` Nicolas Pernas Maradei
2015-10-22  4:44   ` Panu Matilainen
2015-12-06 18:46 ` [PATCH v2 1/2] mk: prepare dependencies in shared libraries not combined Thomas Monjalon
2015-12-06 18:46   ` [PATCH v2 2/2] mk: fix shared library dependencies of drivers Thomas Monjalon
2015-12-06 21:13     ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.