* [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries
@ 2015-12-08 11:47 Panu Matilainen
2015-12-08 16:28 ` Sergio Gonzalez Monroy
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Panu Matilainen @ 2015-12-08 11:47 UTC (permalink / raw)
To: dev
Similar to commit 5f9115e58cc6f304ff4ade694cf5823d32887d1a etc, but
for libraries. Clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion
while at it.
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.
Linking with the combined library (whether shared or not) still
requires knowing the internal dependencies, and intra-dpdk
dependencies are also not currently recorded.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
v2:
- clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion while at it
lib/librte_eal/bsdapp/eal/Makefile | 4 ++++
lib/librte_eal/linuxapp/eal/Makefile | 6 ++++++
lib/librte_sched/Makefile | 3 +++
lib/librte_vhost/Makefile | 6 +++---
mk/rte.app.mk | 20 ++++++++------------
5 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 65b293f..d7e06fd 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -42,6 +42,10 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ring
CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
CFLAGS += $(WERROR_FLAGS) -O3
+LDLIBS += -lpthread
+LDLIBS += -lexecinfo
+LDLIBS += -lgcc_s
+
EXPORT_MAP := rte_eal_version.map
LIBABIVER := 2
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 26eced5..2a0fa2b 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -47,6 +47,12 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem
CFLAGS += $(WERROR_FLAGS) -O3
+LDLIBS += -lpthread
+LDLIBS += -ldl
+LDLIBS += -lrt
+LDLIBS += -lm
+LDLIBS += -lgcc_s
+
# 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_sched/Makefile b/lib/librte_sched/Makefile
index b1cb285..4d631f6 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -41,6 +41,9 @@ CFLAGS += $(WERROR_FLAGS)
CFLAGS_rte_red.o := -D_GNU_SOURCE
+LDLIBS += -lm
+LDLIBS += -lrt
+
EXPORT_MAP := rte_sched_version.map
LIBABIVER := 1
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index 6681f22..4aecc69 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -42,12 +42,12 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
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
ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
-LDFLAGS += -lnuma
+LDLIBS += -lnuma
endif
# all source are stored in SRCS-y
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 8ecab41..4ecaa6c 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -81,23 +81,11 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power
_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter
-
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
-_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
-_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
-
_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost
endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse
-endif
-
# 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.
@@ -111,6 +99,14 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore
_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio
# QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lcrypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma
+endif
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse
+endif
endif # CONFIG_RTE_BUILD_COMBINE_LIBS or not CONFIG_RTE_BUILD_SHARED_LIBS
_LDLIBS-y += --start-group
--
2.5.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries
2015-12-08 11:47 [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries Panu Matilainen
@ 2015-12-08 16:28 ` Sergio Gonzalez Monroy
2015-12-09 12:09 ` Panu Matilainen
2016-03-10 13:15 ` [dpdk-dev] [PATCH v3 0/3] mk: add DT_NEEDED entries for external library deps Panu Matilainen
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Sergio Gonzalez Monroy @ 2015-12-08 16:28 UTC (permalink / raw)
To: Panu Matilainen; +Cc: dev
On 08/12/2015 11:47, Panu Matilainen wrote:
> Similar to commit 5f9115e58cc6f304ff4ade694cf5823d32887d1a etc, but
> for libraries. Clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion
> while at it.
>
> 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.
>
> Linking with the combined library (whether shared or not) still
> requires knowing the internal dependencies, and intra-dpdk
> dependencies are also not currently recorded.
>
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
> ---
>
> v2:
> - clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion while at it
>
>
Hi Panu,
Patch itself looks good but there is a small side effect on BSD that results
in app/test not linking because of missing -lm.
Linuxapp links with -lm by default (EXECENV_LDLIBS), but BSD does not.
Should we just add -lm to EXECENV_LDLIBS for BSD too instead of
adding it on each app/example that uses librte_sched ?
Sergio
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries
2015-12-08 16:28 ` Sergio Gonzalez Monroy
@ 2015-12-09 12:09 ` Panu Matilainen
0 siblings, 0 replies; 10+ messages in thread
From: Panu Matilainen @ 2015-12-09 12:09 UTC (permalink / raw)
To: Sergio Gonzalez Monroy; +Cc: dev
On 12/08/2015 06:28 PM, Sergio Gonzalez Monroy wrote:
> On 08/12/2015 11:47, Panu Matilainen wrote:
>> Similar to commit 5f9115e58cc6f304ff4ade694cf5823d32887d1a etc, but
>> for libraries. Clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion
>> while at it.
>>
>> 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.
>>
>> Linking with the combined library (whether shared or not) still
>> requires knowing the internal dependencies, and intra-dpdk
>> dependencies are also not currently recorded.
>>
>> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
>> ---
>>
>> v2:
>> - clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion while at it
>>
>>
> Hi Panu,
>
> Patch itself looks good but there is a small side effect on BSD that
> results
> in app/test not linking because of missing -lm.
> Linuxapp links with -lm by default (EXECENV_LDLIBS), but BSD does not.
Oh, those LIBRTE_SCHED entries were in a different if-block from the
others...
Hmm, interesting. Without this patch, on Linux -lm gets added twice
which actually causes a build failure on Fedora rawhide (related to some
libmvec related changes it seems).
> Should we just add -lm to EXECENV_LDLIBS for BSD too instead of
> adding it on each app/example that uses librte_sched ?
Linking should be based on usage, not convenience or such... but there's
no explanation why -lm is added everywhere in Linux:
commit 6da94b7a92d9706c1a4fb23a9cf54f49e6019af2
Author: Intel <intel.com>
Date: Wed Sep 18 12:00:00 2013 +0200
mk: link with libm
Signed-off-by: Intel
Certainly librte_sched should link to -lm and in static builds, all its
users, but beyond that I suppose it needs closer investigation of what
(if anything else) actually needs it.
I think we better leave it alone for 2.2, but the librte_vhost part
should be safe. I can send another version with just that if it has a
chance to make it to 2.2, otherwise lets postpone it to 2.3.
- Panu -
- Panu -
- Panu -
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v3 0/3] mk: add DT_NEEDED entries for external library deps
2015-12-08 11:47 [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries Panu Matilainen
2015-12-08 16:28 ` Sergio Gonzalez Monroy
@ 2016-03-10 13:15 ` Panu Matilainen
2016-03-13 19:28 ` Thomas Monjalon
2016-03-10 13:15 ` [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion Panu Matilainen
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Panu Matilainen @ 2016-03-10 13:15 UTC (permalink / raw)
To: dev
Add hopefully all the remaining missing DT_NEEDED entries for external
library dependencies on the libraries side: librte_vhost, librte_sched
and librte_eal.
Panu Matilainen (3):
mk: clear up libm and librt linkage confusion
mk: add DT_NEEDED entries for librte_vhost external dependencies
mk: add DT_NEEDED entries for librte_eal external dependencies
app/test/Makefile | 2 ++
lib/librte_eal/bsdapp/eal/Makefile | 4 ++++
lib/librte_eal/linuxapp/eal/Makefile | 4 ++++
lib/librte_sched/Makefile | 3 +++
lib/librte_vhost/Makefile | 7 ++++---
mk/exec-env/linuxapp/rte.vars.mk | 2 +-
mk/rte.app.mk | 20 ++++++++------------
7 files changed, 26 insertions(+), 16 deletions(-)
--
v3:
- split up to separate patches
- clear up up libm and librt linkage confusion and unnecessary
Linux vs BSD differences
v2:
- clean up librte_vhost CFLAGS/LDFLAGS/LDLIBS confusion while at it
2.5.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion
2015-12-08 11:47 [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries Panu Matilainen
2015-12-08 16:28 ` Sergio Gonzalez Monroy
2016-03-10 13:15 ` [dpdk-dev] [PATCH v3 0/3] mk: add DT_NEEDED entries for external library deps Panu Matilainen
@ 2016-03-10 13:15 ` Panu Matilainen
2016-03-14 16:44 ` Ferruh Yigit
2016-03-10 13:16 ` [dpdk-dev] [PATCH v3 2/3] mk: add DT_NEEDED entries for librte_vhost external dependencies Panu Matilainen
2016-03-10 13:16 ` [dpdk-dev] [PATCH v3 3/3] mk: add DT_NEEDED entries for librte_eal " Panu Matilainen
4 siblings, 1 reply; 10+ messages in thread
From: Panu Matilainen @ 2016-03-10 13:15 UTC (permalink / raw)
To: dev
There are two places that need -lm (test app and librte_sched) and
exactly one that needs -lrt (librte_sched). Add the relevant
DT_NEEDED entries to both, and eliminate the bogus discrepancy
between Linux and BSD EXECENV_LDLIBS wrt these libs.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
app/test/Makefile | 2 ++
lib/librte_sched/Makefile | 3 +++
mk/exec-env/linuxapp/rte.vars.mk | 2 +-
mk/rte.app.mk | 6 ++----
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/app/test/Makefile b/app/test/Makefile
index ec33e1a..00e4df2 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -160,6 +160,8 @@ CFLAGS += $(WERROR_FLAGS)
CFLAGS += -D_GNU_SOURCE
+LDLIBS += -lm
+
# Disable VTA for memcpy test
ifeq ($(CC), gcc)
ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index b1cb285..4d631f6 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -41,6 +41,9 @@ CFLAGS += $(WERROR_FLAGS)
CFLAGS_rte_red.o := -D_GNU_SOURCE
+LDLIBS += -lm
+LDLIBS += -lrt
+
EXPORT_MAP := rte_sched_version.map
LIBABIVER := 1
diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk
index 5fd7d85..d51bd17 100644
--- a/mk/exec-env/linuxapp/rte.vars.mk
+++ b/mk/exec-env/linuxapp/rte.vars.mk
@@ -48,7 +48,7 @@ endif
# Workaround lack of DT_NEEDED entry
EXECENV_LDFLAGS = --no-as-needed
-EXECENV_LDLIBS = -lrt -lm
+EXECENV_LDLIBS =
EXECENV_ASFLAGS =
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index daac09f..cadc7ab 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -77,11 +77,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power
_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter
-
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
-_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
-_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
-
_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost
ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
@@ -104,6 +100,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore
_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio
# QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lcrypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
endif # !CONFIG_RTE_BUILD_SHARED_LIBS
_LDLIBS-y += --start-group
--
2.5.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion
2016-03-10 13:15 ` [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion Panu Matilainen
@ 2016-03-14 16:44 ` Ferruh Yigit
2016-03-15 6:24 ` Panu Matilainen
0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2016-03-14 16:44 UTC (permalink / raw)
To: dev; +Cc: Panu Matilainen
On 3/10/2016 1:15 PM, Panu Matilainen wrote:
> There are two places that need -lm (test app and librte_sched) and
> exactly one that needs -lrt (librte_sched). Add the relevant
> DT_NEEDED entries to both, and eliminate the bogus discrepancy
> between Linux and BSD EXECENV_LDLIBS wrt these libs.
>
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
> ---
> app/test/Makefile | 2 ++
> lib/librte_sched/Makefile | 3 +++
> mk/exec-env/linuxapp/rte.vars.mk | 2 +-
> mk/rte.app.mk | 6 ++----
> 4 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/app/test/Makefile b/app/test/Makefile
> index ec33e1a..00e4df2 100644
> --- a/app/test/Makefile
> +++ b/app/test/Makefile
> @@ -160,6 +160,8 @@ CFLAGS += $(WERROR_FLAGS)
>
> CFLAGS += -D_GNU_SOURCE
>
> +LDLIBS += -lm
> +
> # Disable VTA for memcpy test
> ifeq ($(CC), gcc)
> ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
> diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
> index b1cb285..4d631f6 100644
> --- a/lib/librte_sched/Makefile
> +++ b/lib/librte_sched/Makefile
> @@ -41,6 +41,9 @@ CFLAGS += $(WERROR_FLAGS)
>
> CFLAGS_rte_red.o := -D_GNU_SOURCE
>
> +LDLIBS += -lm
> +LDLIBS += -lrt
> +
> EXPORT_MAP := rte_sched_version.map
>
> LIBABIVER := 1
> diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk
> index 5fd7d85..d51bd17 100644
> --- a/mk/exec-env/linuxapp/rte.vars.mk
> +++ b/mk/exec-env/linuxapp/rte.vars.mk
> @@ -48,7 +48,7 @@ endif
> # Workaround lack of DT_NEEDED entry
> EXECENV_LDFLAGS = --no-as-needed
>
> -EXECENV_LDLIBS = -lrt -lm
> +EXECENV_LDLIBS =
> EXECENV_ASFLAGS =
>
> ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index daac09f..cadc7ab 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -77,11 +77,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
> _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power
> _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
> _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter
> -
> _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
> -
> _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost
>
> ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
> @@ -104,6 +100,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore
> _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio
> # QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes
> _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lcrypto
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
> endif # !CONFIG_RTE_BUILD_SHARED_LIBS
>
> _LDLIBS-y += --start-group
>
This is causing a shared library compilation error with gcc:
"
== Build app/test-acl
LD testacl
/root/dpdk/build/lib/librte_meter.so: error: undefined reference to 'ceil'
collect2: error: ld returned 1 exit status
"
There is an indirect libm dependency from test-acl. Adding -lm fixes the
issue.
But this issue not seen by everybody, not sure why I am getting this but
not others.
Also clang compiles fine, only fails with gcc.
I am using Fedora 23, gcc version:
gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
I will dig some more.
Regards,
ferruh
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion
2016-03-14 16:44 ` Ferruh Yigit
@ 2016-03-15 6:24 ` Panu Matilainen
0 siblings, 0 replies; 10+ messages in thread
From: Panu Matilainen @ 2016-03-15 6:24 UTC (permalink / raw)
To: Ferruh Yigit, dev
On 03/14/2016 06:44 PM, Ferruh Yigit wrote:
> On 3/10/2016 1:15 PM, Panu Matilainen wrote:
>> There are two places that need -lm (test app and librte_sched) and
>> exactly one that needs -lrt (librte_sched). Add the relevant
>> DT_NEEDED entries to both, and eliminate the bogus discrepancy
>> between Linux and BSD EXECENV_LDLIBS wrt these libs.
>>
>> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
>> ---
>> app/test/Makefile | 2 ++
>> lib/librte_sched/Makefile | 3 +++
>> mk/exec-env/linuxapp/rte.vars.mk | 2 +-
>> mk/rte.app.mk | 6 ++----
>> 4 files changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/app/test/Makefile b/app/test/Makefile
>> index ec33e1a..00e4df2 100644
>> --- a/app/test/Makefile
>> +++ b/app/test/Makefile
>> @@ -160,6 +160,8 @@ CFLAGS += $(WERROR_FLAGS)
>>
>> CFLAGS += -D_GNU_SOURCE
>>
>> +LDLIBS += -lm
>> +
>> # Disable VTA for memcpy test
>> ifeq ($(CC), gcc)
>> ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
>> diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
>> index b1cb285..4d631f6 100644
>> --- a/lib/librte_sched/Makefile
>> +++ b/lib/librte_sched/Makefile
>> @@ -41,6 +41,9 @@ CFLAGS += $(WERROR_FLAGS)
>>
>> CFLAGS_rte_red.o := -D_GNU_SOURCE
>>
>> +LDLIBS += -lm
>> +LDLIBS += -lrt
>> +
>> EXPORT_MAP := rte_sched_version.map
>>
>> LIBABIVER := 1
>> diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk
>> index 5fd7d85..d51bd17 100644
>> --- a/mk/exec-env/linuxapp/rte.vars.mk
>> +++ b/mk/exec-env/linuxapp/rte.vars.mk
>> @@ -48,7 +48,7 @@ endif
>> # Workaround lack of DT_NEEDED entry
>> EXECENV_LDFLAGS = --no-as-needed
>>
>> -EXECENV_LDLIBS = -lrt -lm
>> +EXECENV_LDLIBS =
>> EXECENV_ASFLAGS =
>>
>> ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
>> index daac09f..cadc7ab 100644
>> --- a/mk/rte.app.mk
>> +++ b/mk/rte.app.mk
>> @@ -77,11 +77,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter
>> -
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
>> -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
>> -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
>> -
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost
>>
>> ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
>> @@ -104,6 +100,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio
>> # QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lcrypto
>> +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
>> +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
>> endif # !CONFIG_RTE_BUILD_SHARED_LIBS
>>
>> _LDLIBS-y += --start-group
>>
> This is causing a shared library compilation error with gcc:
>
> "
> == Build app/test-acl
> LD testacl
> /root/dpdk/build/lib/librte_meter.so: error: undefined reference to 'ceil'
> collect2: error: ld returned 1 exit status
> "
>
> There is an indirect libm dependency from test-acl. Adding -lm fixes the
> issue.
>
> But this issue not seen by everybody, not sure why I am getting this but
> not others.
>
> Also clang compiles fine, only fails with gcc.
> I am using Fedora 23, gcc version:
> gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
>
> I will dig some more.
Right, librte_meter indeed has a dependency on libm that I've missed.
The curious thing is why is it not failing everywhere - I cannot
reproduce that at all on Fedora 23. Poking around in math.h leads to
bits/mathlinline.h where the answer probably lies: ceil() is typically
provided by inline code, but for one reason or another that is not
available in your setup.
Anyway, I'll send a patch to add the missing dependency, thanks for
spotting and reporting!
- Panu -
> Regards,
> ferruh
>
>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v3 2/3] mk: add DT_NEEDED entries for librte_vhost external dependencies
2015-12-08 11:47 [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries Panu Matilainen
` (2 preceding siblings ...)
2016-03-10 13:15 ` [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion Panu Matilainen
@ 2016-03-10 13:16 ` Panu Matilainen
2016-03-10 13:16 ` [dpdk-dev] [PATCH v3 3/3] mk: add DT_NEEDED entries for librte_eal " Panu Matilainen
4 siblings, 0 replies; 10+ messages in thread
From: Panu Matilainen @ 2016-03-10 13:16 UTC (permalink / raw)
To: dev
Add DT_NEEDED entries for external library dependencies which
are the most critical ones for sane operation.
Clean up vhost_cuse CFLAGS/LDFLAGS confusion while at it.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
lib/librte_vhost/Makefile | 7 ++++---
mk/rte.app.mk | 14 ++++++--------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index ef9bbae..e33ff53 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -41,13 +41,14 @@ LIBABIVER := 2
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),y)
CFLAGS += -I vhost_user
+LDLIBS += -lpthread
else
-CFLAGS += -I vhost_cuse -lfuse
-LDFLAGS += -lfuse
+CFLAGS += -I vhost_cuse
+LDLIBS += -lfuse
endif
ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
-LDFLAGS += -lnuma
+LDLIBS += -lnuma
endif
# all source are stored in SRCS-y
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index cadc7ab..e1cdddf 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -80,14 +80,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched
_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse
-endif
-
# The static libraries do not know their dependencies.
# So linking with static library requires explicit dependencies.
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
@@ -102,6 +94,12 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lcrypto
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm
_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma
+endif
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse
+endif
endif # !CONFIG_RTE_BUILD_SHARED_LIBS
_LDLIBS-y += --start-group
--
2.5.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v3 3/3] mk: add DT_NEEDED entries for librte_eal external dependencies
2015-12-08 11:47 [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries Panu Matilainen
` (3 preceding siblings ...)
2016-03-10 13:16 ` [dpdk-dev] [PATCH v3 2/3] mk: add DT_NEEDED entries for librte_vhost external dependencies Panu Matilainen
@ 2016-03-10 13:16 ` Panu Matilainen
4 siblings, 0 replies; 10+ messages in thread
From: Panu Matilainen @ 2016-03-10 13:16 UTC (permalink / raw)
To: dev
Details between the platforms differ somewhat, and for static
builds they need to be handled from mk/exec-env still.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
lib/librte_eal/bsdapp/eal/Makefile | 4 ++++
lib/librte_eal/linuxapp/eal/Makefile | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 9ecf429..349b0d0 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -44,6 +44,10 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_ring
CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
CFLAGS += $(WERROR_FLAGS) -O3
+LDLIBS += -lexecinfo
+LDLIBS += -lpthread
+LDLIBS += -lgcc_s
+
EXPORT_MAP := rte_eal_version.map
LIBABIVER := 2
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index d72f035..25b3a8e 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -49,6 +49,10 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
CFLAGS += -I$(RTE_SDK)/lib/librte_ivshmem
CFLAGS += $(WERROR_FLAGS) -O3
+LDLIBS += -ldl
+LDLIBS += -lpthread
+LDLIBS += -lgcc_s
+
# specific to linuxapp exec-env
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) := eal.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_hugepage_info.c
--
2.5.0
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-03-15 6:24 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 11:47 [dpdk-dev] [PATCH v2] mk: fix external shared library dependencies of libraries Panu Matilainen
2015-12-08 16:28 ` Sergio Gonzalez Monroy
2015-12-09 12:09 ` Panu Matilainen
2016-03-10 13:15 ` [dpdk-dev] [PATCH v3 0/3] mk: add DT_NEEDED entries for external library deps Panu Matilainen
2016-03-13 19:28 ` Thomas Monjalon
2016-03-10 13:15 ` [dpdk-dev] [PATCH v3 1/3] mk: clear up libm and librt linkage confusion Panu Matilainen
2016-03-14 16:44 ` Ferruh Yigit
2016-03-15 6:24 ` Panu Matilainen
2016-03-10 13:16 ` [dpdk-dev] [PATCH v3 2/3] mk: add DT_NEEDED entries for librte_vhost external dependencies Panu Matilainen
2016-03-10 13:16 ` [dpdk-dev] [PATCH v3 3/3] mk: add DT_NEEDED entries for librte_eal " Panu Matilainen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).