[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#4981) Try -lpthread before -pthread

Full_Name: Russ Allbery
Version: 2.3.35
OS: Debian
Submission from: (NULL) (

Debian has been carrying the included patch for a while, originally added
against 2.1.22 with:

    + Fixed the undefined symbols in libldap_r.so.2 (closes: #195990).
    | configure.in: Try -lpthread before -pthread to link the thread
      library. libtool does not pass -pthread through, -lpthread seems
      to work though.

and then refreshed some time later against 2.2.23 with:

  * configure.in: reinstate the remainder of the fix for 195990 from
    2.1.22-2: give preference to -lpthread over -pthread in configure.in,
    because some archs (mipsel, at least) don't like -pthread.

A quick search of other ITSes didn't reveal this particular report, but it did
look like people building on AIX were manually setting library flags that may
produce the same result.  I'm sure that none of Debian's platforms will break
with -lpthread instead of -pthread since we've been using this for a while,
although I'm not sure if that's sufficient.

I'd ideally like to see Debian stop carrying this patch around as a divergence,
particularly since it means that the package has to re-run Autoconf during the

Index: openldap2.3/configure.in
--- openldap2.3.orig/configure.in       2007-05-23 15:05:12.000000000 -0700
+++ openldap2.3/configure.in    2007-05-23 15:09:38.000000000 -0700
@@ -1489,6 +1489,7 @@ case $ol_with_threads in auto | yes | po
 dnl            OL_PTHREAD_TRY([-mt],           [ol_cv_pthread_mt])
                OL_PTHREAD_TRY([-kthread],      [ol_cv_pthread_kthread])
+               OL_PTHREAD_TRY([-lpthread],     [ol_cv_pthread_lpthread])
                OL_PTHREAD_TRY([-pthread],      [ol_cv_pthread_pthread])
                OL_PTHREAD_TRY([-pthreads],     [ol_cv_pthread_pthreads])
                OL_PTHREAD_TRY([-mthreads],     [ol_cv_pthread_mthreads])