From 7663301ea7ab020d968ec7038413520a9ff560c2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 31 May 2023 12:03:33 +0200 Subject: [PATCH] BUILD: Makefile: use -pthread not -lpthread when threads are enabled -pthread is normally the right way to enable threads, it involves -lpthread at the end of the arguments, and also enables -D_REENTRANT=1. We normally don't care about the subtle difference, but building with a static openssl library that has threads enabled breaks because -lpthread is placed before the SSL_LDFLAGS and openssl doesn't find pthread_atfork(). Let's change the flag to -pthread once for all, that's something we've considered over the last decade without having a good reason to do it since it didn't bring any value. Now at least it fixes a build issues, this is a good reason. This doesn't need to be backported since it is one of the consequences of the new more flexible build options in 2.8. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3b1ff10ab..11096c223 100644 --- a/Makefile +++ b/Makefile @@ -554,7 +554,7 @@ ifneq ($(USE_RT),) endif ifneq ($(USE_THREAD),) - THREAD_LDFLAGS = -lpthread + THREAD_LDFLAGS = -pthread endif ifneq ($(USE_BACKTRACE),)