efd: fix build by removing dependency to libmath
authorOlivier Matz <olivier.matz@6wind.com>
Fri, 27 Jan 2017 14:23:17 +0000 (15:23 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 30 Jan 2017 09:58:40 +0000 (10:58 +0100)
commitcb8fac62beb741e4fdacb41be2b242e964b75f73
treeae09dbd95e94af2934da0175dd073a6ef45491df
parent7eb8895d405b6e5d76259faf524459030c8b8232
efd: fix build by removing dependency 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.

Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
lib/librte_efd/Makefile
lib/librte_efd/rte_efd.c