[03/10] examples/kni: fix build with pkg-config

Message ID 20201110151219.4893-4-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Series Examples compilation fixes |


Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Nov. 10, 2020, 3:12 p.m. UTC
  rm -f build/kni build/kni-static build/kni-shared
test -d build && rmdir -p build || true
/usr/bin/ld: /tmp/cc72ssnK.o: undefined reference to symbol

This example explicitly call pthread API and should be linked against
the pthread library.

Fixes: 724beb913b44 ("examples/kni: monitor and update link state continually")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
 examples/kni/Makefile | 1 +
 1 file changed, 1 insertion(+)


diff --git a/examples/kni/Makefile b/examples/kni/Makefile
index fa9fa85319..bdc8a2aabe 100644
--- a/examples/kni/Makefile
+++ b/examples/kni/Makefile
@@ -24,6 +24,7 @@  PKGCONF ?= pkg-config
 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS += -pthread
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)