curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Undefined reference to pThread issue with 7.55.1

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 26 Sep 2017 02:48:58 -0400

On 9/25/2017 5:30 PM, Daniel Stenberg wrote:
> On Mon, 25 Sep 2017, Ray Satiro via curl-library wrote:
>
>> Daniel when you use --enable-debug do the unit tests build successfully?
>
> Yes. I build and run that several times per day with no problems. On
> Debian unstable/sid.
>
>> Just now I built in Ubuntu from master with --enable-debug and OpenSSL
>> 1.0.2 but it failed building the unit tests:
>
>> //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO
>> missing from command line
>
> I've not seen this one at all.

I'm using -fsanitize=address in cflags and ldflags when I use
--enable-debug in configure, and I've determined that causes pthreads to
be included. Because of that the pthreads detection in the configure
script doesn't think any pthreads option is needed. Here is the repro
which is a mock conftest:

cat << EOF > a.c
#include <stdio.h>

char pthread_create ();
#if defined __stub_pthread_create || defined __stub___pthread_create
choke me
#endif

int main (void)
{
  return pthread_create ();
  return 0;
}

EOF
gcc a.c && echo $?
gcc -fsanitize=address a.c && echo $?

The first one fails and the second one succeeds.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

That still does not explain why the unit tests fail to build due to
missing pthread, since when a unit test is built it's using
-fsanitize=address so I'd expect the same behavior as above. Anyway I
will chalk it up to undocumented behavior and start using LIBS=-lpthread
when I'm using --enable-debug and address sanitizer unless you think
what I'm describing could be a bug.

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-09-26