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.
This commit is contained in:
Willy Tarreau 2023-05-31 12:03:33 +02:00
parent 76a98b4905
commit 7663301ea7
1 changed files with 1 additions and 1 deletions

View File

@ -554,7 +554,7 @@ ifneq ($(USE_RT),)
endif
ifneq ($(USE_THREAD),)
THREAD_LDFLAGS = -lpthread
THREAD_LDFLAGS = -pthread
endif
ifneq ($(USE_BACKTRACE),)