]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: Makefile: use -pthread not -lpthread when threads are enabled
authorWilly Tarreau <w@1wt.eu>
Wed, 31 May 2023 10:03:33 +0000 (12:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 31 May 2023 10:06:41 +0000 (12:06 +0200)
-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

index 3b1ff10ab41a94a51d873679deae2012748b5ce2..11096c22366d784211568477118469f28b691ed8 100644 (file)
--- 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),)