tools/io_uring: fix Makefile for pthread library link [Linux 5.2]

tools/io_uring: fix Makefile for pthread library link [Linux 5.2]

This Linux kernel change "tools/io_uring: fix Makefile for pthread library link" is included in the Linux 5.2 release. This change is authored by Jens Axboe <axboe [at] kernel.dk> on Wed May 22 08:47:54 2019 -0600. The commit for this change in Linux stable tree is 486f069 (patch).

tools/io_uring: fix Makefile for pthread library link

Currently fails with:

io_uring-bench.o: In function `main':
/home/axboe/git/linux-block/tools/io_uring/io_uring-bench.c:560: undefined reference to `pthread_create'
/home/axboe/git/linux-block/tools/io_uring/io_uring-bench.c:588: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
Makefile:11: recipe for target 'io_uring-bench' failed
make: *** [io_uring-bench] Error 1

Move -lpthread to the end.

Signed-off-by: Jens Axboe <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 tools/io_uring/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/io_uring/Makefile b/tools/io_uring/Makefile
index f79522f..00f146c 100644
--- a/tools/io_uring/Makefile
+++ b/tools/io_uring/Makefile
@@ -8,7 +8,7 @@ all: io_uring-cp io_uring-bench
    $(CC) $(CFLAGS) -o [email protected] $^

 io_uring-bench: syscall.o io_uring-bench.o
-   $(CC) $(CFLAGS) $(LDLIBS) -o [email protected] $^
+   $(CC) $(CFLAGS) -o [email protected] $^ $(LDLIBS)

 io_uring-cp: setup.o syscall.o queue.o

Leave a Reply

Your email address will not be published. Required fields are marked *