[tlbuild] icu-65.1 in TL and -lpthread

Bruno Haible bruno at clisp.org
Fri Dec 13 10:33:17 CET 2019

Karl Berry wrote:
> Also, from looking at the autoconf-archive AX_PTHREAD macro, I know that
> the best threading library might not actually be named -lpthread and
> might need other arguments. We can use it if we have to. I just hoped
> the simple test I put in for a -lpthread that provides pthread_create()
> will suffice in our case.

The best threading library *is* named -lpthread on all systems (except
native Windows and Minix).

You need C preprocessor defines
  - -D_THREAD_SAFE (for FreeBSD and AIX),
  - -D_REENTRANT (for Solaris and Tru64).
These need to be set early in the autoconfiguration.

For a program that needs pthread_create, the following options are needed:
  - none on Minix and MSVC (does not support POSIX threads)
  - '-pthread' on systems that understand it (glibc systems, OpenBSD,
    AIX with gcc)
  - '-lpthread' on all other systems (musl libc systems, macOS, FreeBSD,
    NetBSD, AIX without gcc, HP-UX, IRIX, Solaris, Haiku, Cygwin, mingw).

For a program that merely needs locking (pthread_mutex*), the following
options are needed:
  - as above on glibc systems, OpenBSD, AIX,
  - none on all other systems.

On some platforms the ISO C threads API is available as an alternative
to the POSIX threads, but I cannot see practical benefits of using it.[1]


[1] https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00084.html

More information about the tlbuild mailing list