I'm planning to use mingw-w64 for commercial software and I'm looking for info about it's licensing. I was looking through licenses included in package and some discussions on forums and mailing lists and I'm still not quite sure if I can use this compiler for my purpose.

Mingw-w64 with default settings requires you to include three dll's with them:

  • libstdc++-6.dll
  • libgcc_s_seh-1.dll
  • libwinpthread-1.dll

Am I allowed to distribute those files with my own software which would be licensed under my own (commercial) license?

Also, can I link those libraries statically? I was looking through some licenses and I found this file, specifically this quote:

These don't apply to the binaries built with
MinGW-w64 unless you specifically tell MinGW-w64 to link against
these parts, for example, by enabling profiling code.

In addition to the notices in this file, also the notices in
COPYING.MinGW-w64-runtime.txt apply to MinGW-w64. Some (possibly
all) notices in that file may apply also to the binaries built with
this version of MinGW-w64. The idea is that if you create binary
packages of your software with MinGW-w64, you can simply copy
COPYING.MinGW-w64-runtime.txt into your package to fulfill the
license requirements of the MinGW runtime.

Which suggests that if I'm building binaries based on mingw-w64 ones, I have to provide this file with my software, which contains those lines at the end:


This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details.

I'm assuming that it refers to software that I've created, which would mean that I have to distribute my software under GNU LGPL license. Does that mean for me that i have to link this dynamically through dlls in order to keep my own commercial license?


1 Answer 1


You can create and distribute proprietary software using most libraries that ship with mingw.

In general, if you are using a library (which includes libstdc++, libgcc and libwinpthread in your question) your program is subject to the license of the library. If the library is distributed under GPL, your program would also be subject to GPL.

Because of this, standard libraries often have exceptions in their licenses that relax GPL requirements for programs using these libraries.

For libstdc++, the exception is here. libgcc is explicitly mentioned on this page as enjoying the same exception.

The mingw blurb you referenced seems to reference these exceptions but is not legalese. This page states that some parts of mingw are released under non-copyleft licenses, repeats the exceptions to GPL requirements for libstdc++/libgcc, and reiterates that profiling code is licensed under GPL only (i.e. without any exceptions).

Since the profiling library is licensed under GPL without exceptions, if you distribute your application linked to the profiling library the application will also be covered by the GPL. The solution to this is to not distribute your application with profiling enabled.

libwinpthread appears to be this project which is LGPL licensed. Unlike GPL, LGPL does not impose a particular license on your application - you can use an LGPL library in a proprietary application (but if you modify the LGPL library itself, those and only those changes must be published).

To be legally safe and compliant, you need to perform this type of analysis for each library your application links to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.