$ cat foo.c
#include <pthread.h>

pthread_mutex_t mtx_paint = PTHREAD_MUTEX_INITIALIZER;

int main()
{
printf("Hello World
");
pthread_mutex_lock(&mtx_paint);
return 0;
}

$ gcc -static ./foo.c -pthread

$ ./a.out
Segmentation fault

$ gdb ./a.out

(gdb) r
Starting program: /home/eelco/a.out

Program received signal SIGSEGV, Segmentation fault.
0x0804eaa4 in __libc_start_main ()

The problem seems to be Glibc 2.5, since this worked in Nixpkgs 0.10 with Glibc 2.3.6. Problem occurs with both GCC 3.4.6 and 4.1.1. This may be caused by our use of LinuxThreads. We really should switch to NPTL.

Submitted on 26 November 2006 at 11:28

Log in to post comments