How are MIT and GPL compatible?

The matter of open source licenses is simple and complex, and some details are easy to get involved if you are not careful.

Some time ago, I encountered a problem: what are you talking about when you say that the two licenses are compatible? How to judge?

For example, the two most common licenses: MIT and GPL-3.0, one loose and one strict, are they compatible?

If compatible, why is it compatible?

After thinking for a long time, I figured it out.

1. What is License Compatibility?

The so-called compatibility refers to whether two things will conflict when put together, and whether they can be put together.

for example:

The license requirement of software A is: if you use my software, you have to run more than 3 kilometers every day;

The license requirement for software B is: you can use my software and run no more than 1 kilometer per day.

These two pieces of software cannot be released together because their license requirements conflict.

If B's ​​license requirements were changed to:

If you use my software, you must run more than 5 kilometers every day.

There is no conflict, and A and B can be combined and released according to B's license.

2. Are MIT and GPL compatible?

Now let's get back to the topic:

For example, software A is MIT, and software B is GPL-3.0 (hereinafter referred to as GPL). Can these two software be put together to form C and then released?

Note that there is a calling relationship between A and B, and they are not put together without any relationship.

I thought of 3 possibilities:

  1. C is very large, the main component is B, and A is only used as a module.

  2. The author wrote a very small B and called a very large A.

  3. The author directly changed something in A, which is called B.

Although these situations look very different, from the perspective of the license, they are essentially the same, and they are all A+B=C.

So, what is C distributed with? There are also 3 possibilities:

  1. C is released under the GPL

  2. C released with MIT

  3. C is released with other protocols, even in the public space.

Which ones work and which ones don't? My answer is:

  1. C can be released under the GPL because MIT allows it.

  2. C cannot be released with MIT, because the GPL does not allow its own derivatives to be released with MIT.

  3. If you want to use other licenses, you need to analyze it in detail. It may be possible to use AGPL (this is mentioned in Article 13 of GPL-3.0) , but probably not.

Three, analyze

First of all, we must understand:

C is both a derivative of A and a derivative of B.

Because from A, A is added to B to form C; from B, it is B added to A to form C.

Although it sometimes feels unreasonable, for example, B has 1,000 lines, and A has only 10 lines, it is intuitively wrong to say that C is a derivative of A.

But by definition, this is the case, and A can completely consider itself changed from 10 rows to 1010 rows.

Since C is a derivative, let's look at the requirements of the two licenses for derivatives:

MIT's requirement for derivatives is: to reflect A's copyright and MIT statement.

GPL's requirement for derivatives is: the entire C must be released under the GPL.

Do these two requirements conflict?

Do not conflict. You can publish C according to the GPL, and at the same time reflect the copyright and MIT statement of A.

4. What specific provisions are involved?

Please read the MIT agreement carefully, which states its requirements:

68d3d5b6a4d67db43c377ecc784837a7.png

From: https://opensource.org/licenses/MIT

If you don’t want to read English, you can read the interpretation of the Chinese version I wrote: Talking about the spirit of the contract from the MIT agreement

In fact, MIT is required to show the copyright, show the MIT license (showing the link to MIT is also OK) .

In addition, note that MIT allows sublicense (sublicense), so that C (including A inside) has a reasonable basis for publishing under the GPL.

Take a closer look at the GPL agreement. According to Article 2, GPL does not allow sublicense, that is, derivatives can only use GPL:

7fe22944272a5e7fd97c748be3eafb1e.png

From: https://spdx.org/licenses/GPL-3.0-only.html

According to Article 5, the derivatives as a whole must be released under the GPL. In this way, C needs to be released under the GPL, and the same is true for A in C.

a7b8334b917ba09435eece67db605a31.png

As an exception, Article 13 says that the GPL can be compatible with the AGPL, that is, the combination of GPL-3.0 software and AGPL-3.0 software can be released under AGPL-3.0 as a whole.

If you want to know more about it, you can read GPLv3 in Human Words I wrote .

5. So, what should I do?

When you merge A (using MIT) and B (using GPL) to form C.

When distributing C, you should prominently reflect the following in documentation or code.

1. Explain that C is authorized by GPL, such as using LICENSE or COPYING files to declare.

2. Explain that C uses A, explain the copyright of A, and that A uses the MIT agreement. On the one hand, it must be stated in the document, on the other hand, the copyright of A and the MIT agreement must be retained in the code.

In doing so, neither MIT nor GPL is violated. Others have seen that if you want to use C, follow the GPL; if you just want to use A, follow MIT.

6. Example

I found a software called netdata on GitHub, which fits the situation discussed in this article.

The software is located at:

https://github.com/netdata/netdata

It is released under the GPL, but some third-party software used in it is from MIT.

On the home page of the software warehouse and the LICENSE file in the root directory, it is stated that its license is GPL3. But at the same time, it is mentioned that the software uses some third-party software.

4b5f310d9e7c7e2e76fb9fc0ea2ce3d7.png

Open the third party license written above, and you can see that the source, copyright and license information of these third party software are clearly indicated in it:

7a702c6dfb0e6f37eef5fadd3e5f162e.png

The above is a partial screenshot. In fact, there are more than 30 software, most of which are from MIT.

In the code, the author of netdata dare not be sloppy. For example, the reference to the d3pie software, the code header is like this:

57fb9c24f5cc31fa33b52a0bb8004af3.png

That's no problem.

Acknowledgments: My friend Sun Zhenhua provided a lot of help in the formation of this article.

Another: This article only illustrates the compatibility between MIT and GPL-3.0. If you want to know more about the compatibility relationship between licenses, reply " " to 兼容get the "Open Source License Compatibility Guide" led by the Institute of Information and Communications Technology.

Text|Wei Jianfan

Guess you like

Origin blog.csdn.net/vigor2323/article/details/125076234