Building agains dynamic libptread in Debian Stable

Alejandro Perez Mendez alex at
Mon Jul 9 13:27:29 EDT 2012

El 09/07/12 16:37, Russ Allbery escribió:
> 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?

Thank you for your response. Exactly. During compiling time, -pthread is 
included. However, it seems that during linking phase it is not included 
(as PTHREAD_CFLAGS is set, but not PTHREAD_LIBS).
> 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.
I will check how they are built. Can it be due to a configure option not 
documented in --help?


More information about the krbdev mailing list