Question about GCC license for commercial use

David Brown david.brown@hesbynett.no
Wed Jul 16 17:03:21 GMT 2025


On 16/07/2025 17:37, Eli Zaretskii via Gcc wrote:
>> From: Jonathan Wakely <jwakely.gcc@gmail.com>
>> Date: Wed, 16 Jul 2025 16:12:01 +0100
>> Cc: qifan.zhou@xpeedic.com, gcc@gcc.gnu.org
>>
>> On Wed, 16 Jul 2025 at 15:59, Eli Zaretskii <eliz@gnu.org> wrote:
>>>
>>>> Please stop giving bad advice and direct people to read the
>>>> appropriate documentation.
>>>
>>> Why the animosity?  I'm trying to help the OP understand the situation
>>> about which they asked.
>>
>> Well they didn't ask about distributing the DLLs :-)
> 
> They did, indirectly: programs compiled by MinGW GCC are linked
> against libgcc and libstdc++ import libraries, and thus have run-time
> dependency on these DLLs.  Unless the Windows loader can find them on
> the end-user's machine, it will refuse to run the program.  So if they
> intend to distribute their programs, they will have to distribute
> these DLLs with it (or ask the end users to install the DLLs by
> themselves, which would mean the program is not self-contained).

Why would you not simply statically link to these libraries?  I don't 
use MinGW (or Mingw-w64) very often, and have not distributed programs 
compiled with them.  But as far as I know, static linking should work 
fine - then you don't need to distribute the DLL's, you are covered by 
the GPL license exceptions (IANAL), you have no risk of "DLL hell" or 
compatibility issues, and the binaries are likely to be a little faster 
since the linkage is static.

> 
>>>>>> Since linking to these libraries statically is not recommended,
>>>>>> especially if the program is a C++ program, the above means in
>>>>>> practice that the two libraries, if a program is linked to them
>>>>>> dynamically, impose GPL.
>>>>
>>>> This is absolutely wrong.
>>>
>>> Not AFAIK, see above.
>>
>> The libraries themselves are licensed under the GPL, not the program
>> that links to them.
> 
> Agreed about the libraries.  As to the effect on the program, IANAL,
> so I don't know.
> 



More information about the Gcc mailing list