[v3,03/11] examples/kni: fix build with pkg-config

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Nov. 14, 2020, 9:05 a.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
'pthread_join@@GLIBC_2.2.5'

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>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/kni/Makefile | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/examples/kni/Makefile b/examples/kni/Makefile
index fa9fa85319..bbf3bcae12 100644
--- a/examples/kni/Makefile
+++ b/examples/kni/Makefile
@@ -27,6 +27,8 @@  CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
 
+LDFLAGS += -pthread
+
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)