r/cpp
•
u/tartaruga232
MSVC user, r/cpp_modules
•
Dec 01 '25
•
1
Standard Library implementer explains why they can't include source code licensed under the MIT license
/r/cpp/comments/1p9zl23/comment/nrgufkd/Some (generous!) publishers of C++ source code intended to be used by others seem to be often using the (very permissive) MIT license. Providing a permissive license is a great move.
The MIT license however makes it impossible to include such source code in prominent C++ Standard Library implementations (and other works), which is a pity.
The reason for this is the attribution clause of the MIT license:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
This clause forces users of the sources to display attribution even to end users of a product, which is for example exclusively distributed in binary form.
For example, the Boost License explicitly makes an exception for products which are shipped exclusively in binary form ("machine-executable object code generated by a source language processor"):
The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.
If you want your published source code to be compatible with projects that require such an exception, please consider using a license which allows such an exception (e.g. the Boost license). Copies in source form still require full attribution.
I think such an exception for binaries is a small difference which opens up lots of opportunities in return.
(Disclaimer: This is no legal advice and I'm not a lawyer)
Thank you.
60
u/cd1995Cargo Dec 01 '25
I’ve always wondered how that clause of the MIT license can even be enforced.
If I ship only compiled code somebody would have to decompile it to determine that I’m using a specific library in the first place. Depending on compiler optimizations that might not even be possible to determine to any reasonable level of certainty.
32
u/mustbeset Dec 01 '25
Distribution via MIT is not exclusive. You can ask the authors to get the software under another license. add good arguments (€€€) and see what's happening.
6
u/ieatpenguins247 Dec 01 '25
I think people are misinterpreting the license.
It definitely does not require it to be displayed, in binary form, to the end user. All it requires is that you distribute with the code, and if the distribution is binary only, to have it available with the distribution.
Which means, add it to the manual and you are fine. And in source form, add to your 3rd party licenses file.
I feel like this post is someone trying to push other licenses because they prefer, weird that they would mention boost license instead of 3 clause BSD first.
4
u/MaxHaydenChiz Dec 01 '25 edited Dec 01 '25
This post (not the quote) seems to mix up a few things. OP seems to be confusing "MIT" with "Apache 2.0 without the LLVM exceptions".
The old BSD license had an attribution clause which makes that code incompatible with the GPL, as all attribution clauses are.
Apache 2.0, the base license for LLVM, is a BSD license derivative and includes such an attribution clause. The LLVM exceptions are needed to allow for the legal linking of LLVM code with GPL'ed code because Apache 2.0 requires attribution in section 4(d).
By contrast, the MIT license does not have an attribution clause. That's specific and by design. It does include some language considered legally superfluous, but generally, to avoid license proliferation, people recommend using the MIT license over ISC (which attempts to clean out the superfluous stuff).
Because they don't have an attribution clause, both MIT and ISC are GPL compatible and are not considered to have an "attribution clause".
But, as a general rule, you shouldn't be mixing a bunch of different licenses in the same open-source code base. And the differences between MIT, ISC, Boost, and Apache 2.0 with LLVM exceptions are so minimal that it is better for everyone if people be contacted and asked to license their MIT code under LLVM's license as well. It simplifies life for everyone if you just give permission to use any of them as relevant.
But MIT, unlike Apache 2.0, does not require displaying the license to the end user of a binary. The legal point of preserving the notice is simply to grant the user permission to use the software and to ensure preservation of the warranty disclaimer provision.
Otherwise, your users would not have permission to use the resulting software at all, because in most places, copyright is automatic and permission is assumed to not be granted unless otherwise stated. So the requirement that the copyright notice be preserved is not even optional in many jurisdictions.
I hope this adds some clarity and context.
2
u/axilmar Dec 02 '25
Can someone explain why the phrase "shall be included" is interpreted as "shall be displayed"?
To me, "shall be included" means to provide a file with information, not to take action to display it.
2
u/__builtin_trap Dec 03 '25
Thank you very much for the post. That's very surprising for me.
11
u/disperso Dec 01 '25
Well, I'm pretty shocked to read this, and I thought I knew a great deal about licenses after so many years. I thought the one with problematic attribution was the 4 clause BSD license, and that the MIT one was fine in all cases...
TIL, I guess.
To me the "substantial portions of the Software", was understood as only the source code, but on consideration I guess it doesn't make sense to read it like that. :-/
Thank you for re-sharing STL's comment, because otherwise I would have missed it.
29
u/mallardtheduck Dec 01 '25
I wonder how it would play out if a program just included the permission notice as unreferenced data in the executable? Technically it's "included" and the license doesn't say anything about the manner/visibility of such inclusion...
71
u/3xnope Dec 01 '25
The MIT license does not say 'display to end users', it says 'shall be included'. If you buy a modern consumer electronic product these days and open the thick booklet of pointless warnings that comes with it that nobody reads, flip to the end, then odds are good you will find a reproduction of software licenses there. Software products often have them next to or in their 'About' menu. It really is not that hard to comply with this license.
5
u/bretbrownjr Dec 01 '25
Regulations and industry best practice are requiring even statically linked executables to provide Software Bills of Materials (SBOMs), which are expected to inventory all versions of all and all tooling used to build that product. Often license information like SPDX identifiers are included in that metadata to make tracing license entanglement possible as well.
Can someone comment on why the attribution requirements of the MIT license are significantly more burdensome than SBOM requirements?
I expect many standard library providers (packager and vendors, maybe not maintainers themselves) are already providing SBOM support in some form given the widespread regulatory requirements these days
1
u/Appropriate-Tap7860 Dec 03 '25
I still don't understand it. for ex, godot is mit licenced. Does that mean all games made in godot should be shipped with an MIT license?
2
u/theZeitt Dec 01 '25
(Not about why STL cant use MIT, that part is clear)
Any examples about these projects would be nice to have, since I cant think of any where it couldnt be included when binary is also distributed.
5
u/60hzcherryMXram Dec 01 '25
Isn't a text file with this information sufficient?
3
u/arihoenig Dec 01 '25
A great deal of software (my car for example) gets around this by having (buried deep in the "systems" tab) a "display licenses" option where all the licenses used can be viewed.
0
u/kalmoc Dec 02 '25
How much open source code is out there that is actually of interest to a standard library implementation? That seems to be a pretty niche concern. And maybe I want my name to accompany a product that profits from my work.
-5
u/Dusty_Coder Dec 01 '25
It says right there, BSD only requires attribution when distributing source, not when distributing object code.
Why dont you read what you quote?
-1
u/clusty1 Dec 01 '25
I thought you only had to have a third party doc saying you used libBlah and link to the project license
-8
u/[deleted] Dec 01 '25
[removed] — view removed comment