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 MIT licensed. Unlike GPL, MIT does not impose a particular license on your application - you can use an MIT library in a proprietary application.

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

  • 1
    winpthreads is not the project linked in this response. The proper link is this: sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/… All sources of this project seem to have some MIT/BSD license. The tests however are LGPL. This doesn't matter for applications linking to libwinpthreads.
    – Sven
    Commented May 2, 2023 at 23:05
  • 1
    The response is wrong about the LGPL. When linking statically, the LGPL does impose a license on the application.
    – Sven
    Commented May 2, 2023 at 23:06
  • @Sven, changed to MIT. Commented Apr 7 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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