Actually a static pthreads is actually very hard. You need to manually initialize pthreads and it gets a hell of a lot more complicated from then on.

On Wed, Aug 14, 2013 at 8:20 PM, John Brown <> wrote:
On Wed, 14 Aug 2013 19:57:25 +0300, Radu Rendec wrote:
> Hi,
> Is there any easy way to statically link against pthread? Using
> -lpthread always creates a dependency on pthreadGC2.dll, even when using
> -static.

I believe that MinGW distributes only the DLL and its associated import
library. If you want the static library, you will have to compile it

> I also tried using libpthreadGC2.dll.a along with the other objects to
> be linked when producing the executable (instead of using -lpthread),
> but with no effect. I believe this is because libpthreadGC2.dll.a is
> just an "import library" and I'm statically linking the import wrappers,
> not the actual pthread functions.

That is correct. The naming convention is that lib*.a is a static
library and lib*.dll.a is an import library.

John Brown.
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
MinGW-users mailing list

This list observes the Etiquette found at
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at: