I'm using MinGW 5.1.6 with MSYS 1.0.11 to create an application that utilizes pthreads. The pthread library I am using comes from http://sourceware.org/pthreads-win32/. I understand that this is the most common one used under MinGW. I managed to compile the pthread library and link against it, but when the program runs, it crashes. The program I am compiling is the first sample source from a tutorial http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html. I've compiled it on Linux and it ran fine.
Here are the steps I took:
* Compiled the pthreads library using 'make clean GC-static' command. I ran the test inside tests/ and it passed.
* Copied libpthreadGC2.a, pthread.h, sched.h, and sempahore.h to my local source tree.
* Executed the following gcc commands
gcc -g -UNDEBUG -Wall -D__CLEANUP_C -DPTW32_STATIC_LIB -o main.exe main.c
-Iinclude -Llib -lpthreadGC2 -lsupc++ -lws2_32
This is the command that was executed during the test in tests/.
* Ran the program and crashed if it reaches a call to pthread_create().
I tried this on two machines and the result is the same. I haven't installed any other pthread library, so I don't think there's a conflict there.