Building agains dynamic libptread in Debian Stable

Russ Allbery rra at
Mon Jul 9 11:37:48 EDT 2012

Alejandro Perez Mendez <alex at> writes:

> Config.log shows the following:
> configure:5785: checking whether pthreads work with -pthread
> configure:5868: gcc -o conftest -g -O2 -pthread   conftest.c -lresolv  >&5
> configure:5868: $? = 0
> configure:5877: result: yes
> configure:5897: checking for joinable pthread attribute
> configure:5910: gcc -o conftest -g -O2 -pthread   conftest.c -lresolv  >&5
> configure:5910: $? = 0
> configure:5942: result: PTHREAD_CREATE_JOINABLE
> configure:5949: checking if more special flags are required for pthreads
> configure:5956: result: no
> configure:5968: checking for cc_r
> configure:5996: result: gcc
> configure:6029: PTHREAD_CC = gcc
> configure:6031: PTHREAD_CFLAGS = -pthread
> configure:6033: PTHREAD_LIBS =

> I guess that this latter variable should take the "-lpthread" value, but 
> I don't know why it is not working.

You should normally not use -lpthread on Linux.  -pthread is the correct
flag.  However, that flag needs to be passed to the compiler during the
link phase as well as the compilation phase for all the correct things to
happen; maybe that's not happening for some reason?

The libraries packaged for Debian do link with libpthread, so this seems
to be something that you're doing differently than what the Debian
packages do when they're built.

Russ Allbery (rra at             <>

More information about the krbdev mailing list