[dpdk-dev] mk: fix eal shared library dependencies -lrt

Message ID 1458634142-10084-1-git-send-email-danielx.t.mrzyglod@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Daniel Mrzyglod March 22, 2016, 8:09 a.m. UTC
  For GLIBC < 2.17 it is necessery to add -lrt for linker
from glibc > 2.17 The `clock_*' suite of functions (declared in <time.h>) is now
available directly in the main C library. This affect Ubuntu 12.04 in i686
and other older Linux Distros).

Fixes: 4758404a3084 ("mk: fix eal shared library dependencies")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 app/test/Makefile                    | 1 +
 lib/librte_eal/linuxapp/eal/Makefile | 1 +
 2 files changed, 2 insertions(+)
  

Comments

Thomas Monjalon March 22, 2016, 8:55 a.m. UTC | #1
2016-03-22 09:09, Daniel Mrzyglod:
> For GLIBC < 2.17 it is necessery to add -lrt for linker
> from glibc > 2.17 The `clock_*' suite of functions (declared in <time.h>) is now
> available directly in the main C library. This affect Ubuntu 12.04 in i686
> and other older Linux Distros).
[...]
> --- a/app/test/Makefile
> +++ b/app/test/Makefile
> @@ -114,6 +114,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
>  SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
>  
>  ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
> +LDFLAGS += -lrt

Why are you adding it only for librte_sched?
Is it needed by librte_sched or by some functions testing librte_sched?
  
Daniel Mrzyglod March 22, 2016, 9:25 a.m. UTC | #2
>-----Original Message-----
>From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
>Sent: Tuesday, March 22, 2016 9:55 AM
>To: Mrzyglod, DanielX T <danielx.t.mrzyglod@intel.com>
>Cc: dev@dpdk.org
>Subject: Re: [dpdk-dev] [PATCH] mk: fix eal shared library dependencies -lrt
>
>2016-03-22 09:09, Daniel Mrzyglod:
>> For GLIBC < 2.17 it is necessery to add -lrt for linker
>> from glibc > 2.17 The `clock_*' suite of functions (declared in <time.h>) is now
>> available directly in the main C library. This affect Ubuntu 12.04 in i686
>> and other older Linux Distros).
>[...]
>> --- a/app/test/Makefile
>> +++ b/app/test/Makefile
>> @@ -114,6 +114,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) +=
>test_cmdline_string.c
>>  SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
>>
>>  ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
>> +LDFLAGS += -lrt
>
>Why are you adding it only for librte_sched?
>Is it needed by librte_sched or by some functions testing librte_sched?

Every clock_gettime() needs -lrt for >=GLIBC2.17. For glibc2.17 and above  `clock_*' suite of functions (declared in <time.h>) is now available
directly in the main C library.
In test it's only in test_red.c and I see that I missed it in ptpclient example probably. So I will send Patch v2
  

Patch

diff --git a/app/test/Makefile b/app/test/Makefile
index 00e4df2..707930f 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -114,6 +114,7 @@  SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
 
 ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
+LDFLAGS += -lrt
 SRCS-y += test_red.c
 SRCS-y += test_sched.c
 endif
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 25b3a8e..1860739 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -52,6 +52,7 @@  CFLAGS += $(WERROR_FLAGS) -O3
 LDLIBS += -ldl
 LDLIBS += -lpthread
 LDLIBS += -lgcc_s
+LDLIBS += -lrt
 
 # specific to linuxapp exec-env
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) := eal.c