Cannot link in static pthreadGC2

Archambault Fabien fabien.archambault at nanotimes.fr
Tue May 31 08:16:59 UTC 2011


On 05/30/2011 08:54 PM, Erik van Pienbroek wrote:
> 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

Hi,

thanks for this answer that explains in a very clear way why it did not 
work.
I believe I will have to bundle the library for the moment as you said. 
I will also try to recompile the RPM to try if it is possible to build 
the static lib but with few hope to get something working...

Really thanks for all your explanations,
Fabien


More information about the mingw mailing list