* [dpdk-dev] [PATCH] efd: fix compilation by removing dep to libmath
@ 2017-01-27 14:23 Olivier Matz
2017-01-27 14:45 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 3+ messages in thread
From: Olivier Matz @ 2017-01-27 14:23 UTC (permalink / raw)
To: dev, byron.marohn, pablo.de.lara.guarch
When we compile the dpdk with:
CONFIG_RTE_LIBRTE_EFD=y
CONFIG_RTE_LIBRTE_NFP_PMD=n
CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=n
CONFIG_RTE_LIBRTE_SCHED=n
CONFIG_RTE_LIBRTE_METER=n
The linker gives the following error:
lib/librte_efd.a(rte_efd.o): In function `rte_efd_create':
lib/librte_efd/rte_efd.c:560: undefined reference to `log2'
collect2: error: ld returned 1 exit status
This is because the '-lm' is missing in mk/rte.app.mk.
An alternative, which is proposed by this patch, is to use the compiler
builtin rte_bsf32() to process log2 instead of the libmath log2() that
requires to include math.h and link with -lm.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
lib/librte_efd/Makefile | 2 --
lib/librte_efd/rte_efd.c | 3 +--
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index 8848c58..a442c62 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -34,8 +34,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_efd.a
-LDLIBS += -lm
-
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
diff --git a/lib/librte_efd/rte_efd.c b/lib/librte_efd/rte_efd.c
index 68e6dab..f601d62 100644
--- a/lib/librte_efd/rte_efd.c
+++ b/lib/librte_efd/rte_efd.c
@@ -36,7 +36,6 @@
#include <inttypes.h>
#include <errno.h>
#include <stdarg.h>
-#include <math.h>
#include <sys/queue.h>
#include <rte_log.h>
@@ -557,7 +556,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
num_chunks = rte_align32pow2((max_num_rules /
EFD_TARGET_CHUNK_NUM_RULES) + 1);
- num_chunks_shift = log2(num_chunks);
+ num_chunks_shift = rte_bsf32(num_chunks);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
--
2.8.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] efd: fix compilation by removing dep to libmath
2017-01-27 14:23 [dpdk-dev] [PATCH] efd: fix compilation by removing dep to libmath Olivier Matz
@ 2017-01-27 14:45 ` De Lara Guarch, Pablo
2017-01-30 9:58 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2017-01-27 14:45 UTC (permalink / raw)
To: Olivier Matz, dev, Marohn, Byron
> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Friday, January 27, 2017 2:23 PM
> To: dev@dpdk.org; Marohn, Byron; De Lara Guarch, Pablo
> Subject: [PATCH] efd: fix compilation by removing dep to libmath
>
> When we compile the dpdk with:
> CONFIG_RTE_LIBRTE_EFD=y
> CONFIG_RTE_LIBRTE_NFP_PMD=n
> CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=n
> CONFIG_RTE_LIBRTE_SCHED=n
> CONFIG_RTE_LIBRTE_METER=n
>
> The linker gives the following error:
> lib/librte_efd.a(rte_efd.o): In function `rte_efd_create':
> lib/librte_efd/rte_efd.c:560: undefined reference to `log2'
> collect2: error: ld returned 1 exit status
>
> This is because the '-lm' is missing in mk/rte.app.mk.
>
> An alternative, which is proposed by this patch, is to use the compiler
> builtin rte_bsf32() to process log2 instead of the libmath log2() that
> requires to include math.h and link with -lm.
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Nice catch, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] efd: fix compilation by removing dep to libmath
2017-01-27 14:45 ` De Lara Guarch, Pablo
@ 2017-01-30 9:58 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-01-30 9:58 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, De Lara Guarch, Pablo, Marohn, Byron
2017-01-27 14:45, De Lara Guarch, Pablo:
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> >
> > When we compile the dpdk with:
> > CONFIG_RTE_LIBRTE_EFD=y
> > CONFIG_RTE_LIBRTE_NFP_PMD=n
> > CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=n
> > CONFIG_RTE_LIBRTE_SCHED=n
> > CONFIG_RTE_LIBRTE_METER=n
> >
> > The linker gives the following error:
> > lib/librte_efd.a(rte_efd.o): In function `rte_efd_create':
> > lib/librte_efd/rte_efd.c:560: undefined reference to `log2'
> > collect2: error: ld returned 1 exit status
> >
> > This is because the '-lm' is missing in mk/rte.app.mk.
> >
> > An alternative, which is proposed by this patch, is to use the compiler
> > builtin rte_bsf32() to process log2 instead of the libmath log2() that
> > requires to include math.h and link with -lm.
> >
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> Nice catch, thanks!
Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-30 9:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 14:23 [dpdk-dev] [PATCH] efd: fix compilation by removing dep to libmath Olivier Matz
2017-01-27 14:45 ` De Lara Guarch, Pablo
2017-01-30 9:58 ` Thomas Monjalon
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).