|
From: Eli Z. <el...@gn...> - 2015-06-23 18:29:14
|
> From: "Earnie" <ea...@us...> > Date: Tue, 23 Jun 2015 14:00:16 -0400 > > > At this point I can't get rid of pthreadGC2.dll. Linking statically either makes no > > effect (.exe file still needs pthreadGC2.dll) or fails with errors: > > ln.exe -s `g++ -print-file-name=libgomp.a` > > g++ openmp.cpp -o openmp.exe -static-libgcc -static-libstdc++ -fopenmp -L. > > C:\for_openmp_test/libgomp.a(env.o):(.text.startup+0xbfe): undefined > > reference to `_imp__pthread_attr_init' > > C:\for_openmp_test/libgomp.a(env.o):(.text.startup+0xc13): undefined > > reference to _imp__pthread_attr_setdetachstate' > > C:\for_openmp_test/libgomp.a(env.o):(.text.startup+0x3c): undefined reference > > to '_imp__pthread_attr_setstacksize' > > After searching through the mailing list I have come across several possible > > solutions, but the treads are rather old. > > My questions are: > > 1. Do I still need to somehow compile pthread statically? And libpthreadGC2.a is > > not actually a static library? If so, is there an updated instruction? > > 2. Are there any other libraries I need to actually make this work? In Linux it is > > said that pthread needs to be included with libc.a and won't link without it. > > Thank you in advance. > > The design of the pthread library is such that it must be dynamic. It is impossible to do otherwise. The alternative is to use the Windows methods for threading in the package you're building instead of relying on POSIX threading model. Based on the error messages, I understand that it's libgomp that was configured to use pthreads, and is the reason why pthreadGC2.dll is needed, is that right? IOW, to avoid this problem, one needs to rebuild libgomp, configuring it to use win32 threads instead (assuming libgomp supports such a configuration), correct? Are there any other GCC components that depend on pthreads? TIA |