r/cpp • MSVC user, r/cpp_modules • Dec 01 '25 • WOW 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.

277 Upvotes

126 comments sorted by

View all comments

Show parent comment

2

u/wyrn Dec 05 '25

I don't understand your use of the word "viral". "Virality" to me would seem to indicate that if I use a MIT-licensed library, I'd also need to release my code under a MIT license. But nobody's claiming that. The claim is simply that, to comply with a license that says "permission is hereby granted (...) subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software", one must include said copyright and permission notice in all copies or substantial portions of the Software.

Would using, say, nlohmann::json in my program constitute at least a "substantial portion" of the library? To me, and to most others here, it would seem that it would. I don't think "it was fine for decades" is necessarily a great argument especially if there's no actual court case to reference. It could very well be that things were, in fact, not fine.

Put another way, if the MIT license text doesn't say that I should include that copyright and permission notice when I distribute code originally licensed under these terms, what does it say?

1

u/MaxHaydenChiz Dec 08 '25

OP made the argument that if you used a header from a cpp standard library that was under an MIT license, then, uniquely because of templates, you'd had to include the copyright notice for the standard library you used in every binary provided to the end user.

And if a bunch of people contributed, then you'd eventually have a massively long list of copyright notices that would be impractical to provide.

That's the virality I'm talking about. The infinite propagation of copyright is notices because OP assumed that code used to generate code creates a derivative work.

This same logic can apply without C++ for all kinds of crazy consequences. But in this case, most objectionably, it strongly implies that every binary ever built with LLVM before version 9 has a stealth copyright problem that allows any contributor to LLVM from before that era to sue you and all of your end users for copyright violations.

That's pure fud. And OP's entire argument is predicated on a misunderstanding of Microsoft's policy. "Dealing with tons of different licenses is a PITA so we adopted the exact same policy as all the major open source C++ libraries" is not the same as what OP attributed to them.

Does this clarify?