I haven't tried 4.7 yet.

OpenBSD xobsd.jkhome 4.6 obj#0 i386
$ cat 1.c
#include <stdio.h>
#include <pthread.h>

void* thread1(void* a)
{
  printf("%p\n", pthread_self());
  return 0;
}

int main()
{
  pthread_t t1;

  printf("%p\n", pthread_self());
  pthread_create(&t1, NULL, thread1, 0);
  sleep(100);
  return 0;
}

$ gcc 1.c  -L/usr/X11R6/lib -lX11 -pthread -static
$ ./a.out
0x0
0x0


I use -static deliberately so I can give binaries that work on other OpenBSD
versions.
I give source too, it's not too keep source private, but it is for "ease of
use".


Putting -lpthread (not -pthread) ahead of -lX11 fixes it.


I suppose there is a goal to enable using -lX11 without using -pthread?
And I suppose -static isn't meant to be much supported?
  Merging libpthread into libc is the way imho.


 - Jay

Reply via email to