I'm getting pthread linker errors when building libschroedinger for mingw32. This is my configure line:

./configure --with-thread=pthread --with-gnu-ld --disable-gtk-doc --enable-static --disable-shared --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32

I'm not using --with-thread=win32 because my frontend uses pthreads. I don't want any type of answer even remotely close to "use win32 threads." I'm using pthreads. Period.

It compiles just fine, but this is the linker error:

libtool: link: x86_64-w64-mingw32-gcc -Wall -Werror -I.. -I/usr/include/orc-0.4 -DSCHRO_ENABLE_UNSTABLE_API -w -O3 -o arith.exe arith.o  -L/usr/local/x86_64-w64-mingw32/lib ./.libs/libschrotest.a /home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a ../schroedinger/.libs/libschroedinger-1.0.a /usr/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib/libstdc++.dll.a -lpthread /usr/local/x86_64-w64-mingw32/lib/liborc-test-0.4.a /usr/local/x86_64-w64-mingw32/lib/liborc-0.4.a -L/usr/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib -L/usr/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x23): undefined reference to `__imp_pthread_setspecific'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x2a): undefined reference to `__imp_pthread_cond_signal'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x31): undefined reference to `__imp_pthread_cond_wait'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x73): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x18a): undefined reference to `__imp_pthread_cond_wait'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x20d): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x27e): undefined reference to `__imp_pthread_mutex_lock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x351): undefined reference to `__imp_pthread_mutexattr_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x35f): undefined reference to `__imp_pthread_mutex_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x36a): undefined reference to `__imp_pthread_condattr_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x37a): undefined reference to `__imp_pthread_cond_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x3a2): undefined reference to `__imp_pthread_attr_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x3ac): undefined reference to `__imp_pthread_mutex_lock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x3ba): undefined reference to `__imp_pthread_create'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x3ff): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x40a): undefined reference to `__imp_pthread_attr_destroy'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x415): undefined reference to `__imp_pthread_mutexattr_destroy'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x420): undefined reference to `__imp_pthread_condattr_destroy'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x49d): undefined reference to `__imp_pthread_key_create'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x4f8): undefined reference to `__imp_pthread_mutex_lock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x50f): undefined reference to `__imp_pthread_cond_signal'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x516): undefined reference to `__imp_pthread_cond_wait'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x53e): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x54d): undefined reference to `__imp_pthread_join'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x5b7): undefined reference to `__imp_pthread_cond_broadcast'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x5eb): undefined reference to `__imp_pthread_mutex_lock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x5fa): undefined reference to `__imp_pthread_cond_wait'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x615): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x649): undefined reference to `__imp_pthread_cond_broadcast'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x6d1): undefined reference to `__imp_pthread_cond_timedwait'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x807): undefined reference to `__imp_pthread_mutex_lock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x827): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x847): undefined reference to `__imp_pthread_cond_broadcast'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x871): undefined reference to `__imp_pthread_mutex_lock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x8cf): undefined reference to `__imp_pthread_attr_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x8f7): undefined reference to `__imp_pthread_create'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x905): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x910): undefined reference to `__imp_pthread_attr_destroy'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x93d): undefined reference to `__imp_pthread_getspecific'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x969): undefined reference to `__imp_pthread_mutexattr_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x977): undefined reference to `__imp_pthread_mutex_init'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x982): undefined reference to `__imp_pthread_mutexattr_destroy'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x997): undefined reference to `__imp_pthread_mutex_lock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x9b7): undefined reference to `__imp_pthread_mutex_unlock'
/home/Leo/ffmpeg-w64/libschroedinger/schroedinger/.libs/libschroedinger-1.0.a(libschroedinger_1.0_la-schroasync-pthread.o):schroasync-pthread.c:(.text+0x9da): undefined reference to `__imp_pthread_mutex_destroy'
collect2: ld returned 1 exit status
make[3]: *** [arith.exe] Error 1
make[3]: Leaving directory `/home/Leo/ffmpeg-w64/libschroedinger/testsuite'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/Leo/ffmpeg-w64/libschroedinger/testsuite'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Leo/ffmpeg-w64/libschroedinger'
make: *** [all] Error 2

When I run x86_64-w64-mingw32-nm on libschroedinger_1.0_la-schroasync-pthread.o, it does show those symbols with a U (undefined). However all the symbols are in libpthread.a except without the __imp_ in the front i.e. in libpthread.a there's pthread_join, not __imp_pthread_join.

1. Are these undefined symbols actually trying to reference the ones without the __imp_ at the beginning?
2. I couldn't fine these defined anywhere, so doing find-and-replace on the source code is a little difficult.
3. How can I make it so it is actually referencing the symbols in libpthread.a (e.g. pthread_join) and not these undefined things (e.g. __imp_pthread_join). I already tried adding -DNO_PREFIX to CPPFLAGS and CFLAGS before configure, then re-configuring. That didn't work.

Thanx.