Archambault Fabien schreef op ma 30-05-2011 om 16:36 [+0200]:
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?
No, when you use -lpthread (and there are both a static and a shared
library available) then the binary will be linked against the shared
library. If you really want to link against a static lib then you have
to refer to it using the full path (and without the '-l' flag), so
you'll get something like:
x86_64-w64-mingw32-gfortran -o omp omp.F -static
-fopenmp /usr/x86_64-w64-mingw32/sys-root/mingw-lib/libpthreadGC2.a
However, there's another catch here. There is no
mingw32/64-pthreads-static package available at the moment..so the above
command won't work. If you want to run your application you need to
bundle the pthread dll for now.
Kind regards,
Erik van Pienbroek