Cannot link in static pthreadGC2

Archambault Fabien fabien.archambault at nanotimes.fr
Mon May 30 14:36:47 UTC 2011


Hi all,

I have found something that is somehow common within my google research 
but I could not find any topic that solves the issue. Except perhaps 
this one (in French) 
http://www.developpez.net/forums/d787443/c-cpp/c/dll-manquante-pthread-lib/#post4532634 
but I do not understand how he really achieved it.

In order to reproduce the issue I used the hello world from wikipedia: 
http://en.wikipedia.org/wiki/OpenMP#Fortran_77
I named it omp.F

Compiled with: gfortran -o omp omp.F -fopenmp -lpthread
This works:
$ ./omp
  HELLO WORLD FROM THREAD           0
  HELLO WORLD FROM THREAD           3
  HELLO WORLD FROM THREAD           2
  HELLO WORLD FROM THREAD           1
  THERE ARE           4 THREADS

Then I tried to compile it for Windows 64 and 32 bits but it fails when 
running.
Compiled with:
x86_64-w64-mingw32-gfortran -o omp omp.F -static -fopenmp -lpthread 
-lpthreadGC2
i686-w64-mingw32-gfortran -o omp omp.F -static -fopenmp -lpthread 
-lpthreadGC2
or
x86_64-w64-mingw32-gfortran -o omp omp.F -static -fopenmp -lpthread
i686-w64-mingw32-gfortran -o omp omp.F -static -fopenmp -lpthread

When running it under an XP computer (32 or 64 bits depending on the 
binary) it always fails with: pthreadGC2.dll was not found.
I really need this in static so adding the flag -static should have 
solved and used the .a file, isn't it?

On my computer I have the mingw-pthread package installed:
mingw32-pthreads-2.8.0-14.cvs20110104.fc15_cross.noarch
mingw64-pthreads-2.8.0-14.cvs20110104.fc15_cross.noarch

Also:
# locate *pthreadGC2*
/usr/i686-w64-mingw32/sys-root/mingw/bin/pthreadGC2.dll
/usr/i686-w64-mingw32/sys-root/mingw/lib/libpthreadGC2.a
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/pthreadGC2.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libpthreadGC2.a

I hope there is a solution,
Fabien


More information about the mingw mailing list