[dpdk-dev] [PATCH v2 04/11] examples/l2fwd-crypto: fix build with pkg-config

Bruce Richardson bruce.richardson at intel.com
Fri Nov 13 14:53:14 CET 2020


On Fri, Nov 13, 2020 at 01:24:23PM +0100, David Marchand wrote:
> Two issues fixed here.
> 
> First add the experimental flag.
> Then fix a link issue with the crypto scheduler driver:
> /usr/bin/ld: /tmp/cchr7aHA.o: in function `main':
> main.c:(.text.startup+0x1673): undefined reference to
> `rte_cryptodev_scheduler_workers_get'
> collect2: error: ld returned 1 exit status
> 
> Fixes: e3bcb99a5e13 ("examples/l2fwd-crypto: limit number of sessions")
> Fixes: 261bbff75e34 ("examples: use separate crypto session mempools")
> 
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
>  examples/l2fwd-crypto/Makefile | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/examples/l2fwd-crypto/Makefile b/examples/l2fwd-crypto/Makefile
> index 4953ee2b95..211a076699 100644
> --- a/examples/l2fwd-crypto/Makefile
> +++ b/examples/l2fwd-crypto/Makefile
> @@ -24,8 +24,14 @@ PKGCONF ?= pkg-config
>  PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
>  CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
>  LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
> +NEED_CRYPTO_SCHEDULER = $(shell echo RTE_CRYPTO_SCHEDULER | $(CPP) $(CFLAGS) -P - | tail -1)
> +ifeq ($(NEED_CRYPTO_SCHEDULER), 1)

Sorry for the last-minute comment, but I wonder for this check if we can do
better by adding into each makefile something like:

CONFIG_DEFINES=$(shell $(CC) $(CFLAGS) -dM -E - < /dev/null)

Then we can easily do multiple checks for vars as needed using findstring,
e.g.

ifeq ($(findstring RTE_CRYPTO_SCHEDULER,$(CONFIG_DEFINES),)
$(info No crypto scheduler found)
else
...
endif

Whatever approach we use here, I'd like applicable across all makefiles for
consistency, and shelling out per-value seems wasteful. Pulling all macro
values also allows checks for architecture and instruction set levels too,
if so desired.

/Bruce

> +LDFLAGS_SHARED += -lrte_crypto_scheduler
> +endif
>  LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
>  
> +CFLAGS += -DALLOW_EXPERIMENTAL_API
> +
>  build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
>  	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
>  
> -- 
> 2.23.0
> 


More information about the dev mailing list