122

The MIT license is GPL-compatible. Is the GPL license MIT-compatible? i.e. I can include MIT-licensed code in a GPL-licensed product, but can I include GPL-licensed code in a MIT-licensed product?

It seems to me that the chief difference between the MIT license and GPL is that the MIT doesn't require modifications be open sourced whereas the GPL does. Is that correct? Is the GPL is more restrictive than the MIT license?

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
fruzer
  • 1,264
  • 3
  • 9
  • 4

4 Answers4

76

It seems to me that the chief difference between the MIT license and GPL is that the MIT doesn't require modifications be open sourced whereas the GPL does.

True - in general. You don't have to open-source your changes if you're using GPL. You could modify it and use it for your own purpose as long as you're not distributing it. BUT... if you DO distribute it, then your entire project that is using the GPL code also becomes GPL automatically. Which means, it must be open-sourced, and the recipient gets all the same rights as you - meaning, they can turn around and distribute it, modify it, sell it, etc. And that would include your proprietary code which would then no longer be proprietary - it becomes open source.

The difference with MIT is that even if you actually distribute your proprietary code that is using the MIT licensed code, you do not have to make the code open source. You can distribute it as a closed app where the code is encrypted or is a binary. Including the MIT-licensed code can be encrypted, as long as it carries the MIT license notice.

is the GPL is more restrictive than the MIT license?

Yes, very much so.

Ravi Jayagopal
  • 916
  • 7
  • 10
  • 16
    May I just note, GPL doesn't make software "open-source". Software under GPL becomes FREE (as in protecting its user's freedom). Free software is a movement older and more meaningful than the open-stuff. Here's an article about the differences: https://www.gnu.org/philosophy/open-source-misses-the-point.html . Thanks – Jorge Orpinel Pérez Mar 17 '14 at 21:11
  • 11
    For the same reasons, one could argue that MIT is more restrictive, since it doesn't protect all the freedoms of the user and can lead to software privatization (=restriction and loss of its control by the user). Thanks again – Jorge Orpinel Pérez Mar 17 '14 at 21:17
  • 2
    @JorgeOrpinel That would make this a very political/philosophical question and here is probably not the right place for this. To me "free" really means "everyone can do anything with it" and that's not the case with the GPL. – tcurdt May 24 '14 at 07:19
  • 2
    @JorgeOrpinel stackoverflow is for programming questions (and hence this was closed as off topic). If you take it the political/philosophical direction it's even more so. – tcurdt May 25 '14 at 21:11
  • 1
    What restrictions on MIT/BSD/Apache licensed code are you referring to? Real restrictions I only see with the GPL. And restrictions don't mean freedom to me. I doubt I will convince you - but you will also not convince me. So there really is no point of discussing this further - not via comments. I'd advise people to just read the licenses. – tcurdt May 25 '14 at 21:22
  • 8
    @JorgeOrpinel "Only code with no license could fall in that category." That is very very wrong, code with no license is PROPRIETARY / "all rights reserved". If you go around and redistribute code that other people have made without a license you are risking a lot of legal trouble. You say you are trying to "help you and other readers" but getting readers sued isn't exactly very helpful. Just FYI. – semicolon Feb 24 '15 at 18:12
45

Can I include GPL licensed code in a MIT licensed product?

You can. GPL is free software as well as MIT is, both licenses do not restrict you to bring together the code where as "include" is always two-way.

In copyright for a combined work (that is two or more works form together a work), it does not make much of a difference if the one work is "larger" than the other or not.

So if you include GPL licensed code in a MIT licensed product you will at the same time include a MIT licensed product in GPL licensed code as well.

As a second opinion, the OSI listed the following criteria (in more detail) for both licenses (MIT and GPL):

  1. Free Redistribution
  2. Source Code
  3. Derived Works
  4. Integrity of The Author's Source Code
  5. No Discrimination Against Persons or Groups
  6. No Discrimination Against Fields of Endeavor
  7. Distribution of License
  8. License Must Not Be Specific to a Product
  9. License Must Not Restrict Other Software
  10. License Must Be Technology-Neutral

Both allow the creation of combined works, which is what you've been asking for.

If combining the two works is considered being a derivate, then this is not restricted as well by both licenses.

And both licenses do not restrict to distribute the software.

It seems to me that the chief difference between the MIT license and GPL is that the MIT doesn't require modifications be open sourced whereas the GPL does.

The GPL doesn't require you to release your modifications only because you made them. That's not precise.

You might mix this with distribiution of software under GPL which is not what you've asked about directly.

Is that correct - is the GPL is more restrictive than the MIT license?

This is how I understand it:

As far as distribution counts, you need to put the whole package under GPL. MIT code inside of the package will still be available under MIT whereas the GPL applies to the package as a whole if not limited by higher rights.

"Restrictive" or "more restrictive" / "less restrictive" depends a lot on the point of view. For a software-user the MIT might result in software that is more restricted than the one available under GPL even some call the GPL more restrictive nowadays. That user in specific will call the MIT more restrictive. It's just subjective to say so and different people will give you different answers to that.

As it's just subjective to talk about restrictions of different licenses, you should think about what you would like to achieve instead:

  • If you want to restrict the use of your modifications, then MIT is able to be more restrictive than the GPL for distribution and that might be what you're looking for.
  • In case you want to ensure that the freedom of your software does not get restricted that much by the users you distribute it to, then you might want to release under GPL instead of MIT.

As long as you're the author it's you who can decide.

So the most restrictive person ever is the author, regardless of which license anybody is opting for ;)

hakre
  • 193,403
  • 52
  • 435
  • 836
  • 1
    "MIT code inside of the package will still be available under MIT" im not completely sure about it. a GPL+MIT project should turn in a open source project, including the MIT part. For other matter, LGPL is less intrusive for the whole project. – magallanes Sep 14 '11 at 12:47
  • What do you mean? I don't understand the should part, is it something you would like to do or are you generally speaking? If generally, it normally does, regardless of the licenses that get incorporated. LGPL might be easier to change to GPL however, but take care, you sometimes want to preserve the licenses explicitly to contribute back to upstream projects: [Maintaining Permissive-Licensed Files in a GPL-Licensed Project: Guidelines for Developers](http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html) – hakre Sep 14 '11 at 12:52
  • 13
    Although you clarify later in your answer, it is very misleading to start off by saying that "you can" include GPL-licensed code in a MIT-licensed project. A project that was originally MIT-licensed *can no longer be distributed as a whole under the MIT license* once it contains code that is only available under GPL. – antinome Aug 15 '12 at 14:41
  • @antinome: No, what you talk about is distribution, but the inclusion is always possible. And about inclusion has been asked upfront, so the differentiation is done later in the answer. That was not done to hide away these. Also changes to MIT licensed fragments *should* be done under MIT license as well if you do not have a very specific reason to not do so. – hakre Aug 15 '12 at 15:12
  • 3
    It is also misleading to claim that restrictiveness is subjective. It is a reasonable and non-subjective question to ask "what actions may I legally perform with these files I have obtained?" Under GPL, that set of actions is in fact a proper subset of what those actions would have been under MIT. – antinome Aug 15 '12 at 15:29
  • 1
    @hakra: Inclusion of GPL-licensed code in a MIT-licensed project is not possible because the resulting whole is no longer MIT-licensed, even if you don't distribute it. (If it were, then the terms of the MIT license *would* allow you to distribute it!) – antinome Aug 15 '12 at 15:33
  • @antinome: Show the terms which prevent that or otherwise accept the fact that *all* Free Software licenses approved by OSI or FSF or Debian allow the inclusion of code into each other. Possible for example by 3. above. – hakre Aug 15 '12 at 15:43
  • 1
    @hakra: You and I already agree that it is impossible to distribute a MIT+GPL combined work solely under the MIT license. I only pointed out that, logically, since the combined work can never be distributed solely under MIT, it could never have been licensed solely under MIT, even before distribution, since MIT explicitly allows distribution. That seems clear and uncontroversial to me, so please let me know specifically where your disagreement lies and I will try to address it. – antinome Aug 15 '12 at 16:14
  • If inclusion means re-license for you, well then naturally not. I do not understand the term inclusion that way. Probably that causes the dissent. But the assumption you do is wrong. Free Software does not require you to distribute your changes. You can even mix it with proprietary code. That logically makes very much sense regardless of distribution *just* to give a counter-example. However, if you *aim* for distribution you should understand the concepts of copyleft and permissive licenses. Also it was never asked for solely. Mixing MIT and GPL works very well in practice btw.. – hakre Aug 15 '12 at 16:33
  • 1
    @hakra: I think maybe we agree about everything except the use of the word "include". Can I include a 10000-word paragraph in a short article? I think "no, absolutely not" or "yes, but the result is no longer short" would be good answers. To say "yes" all by itself would be misleading to me. – antinome Aug 15 '12 at 16:43
  • @antinome: Superset and subset, I'm sure you'll manage that one day ;) – hakre Aug 16 '12 at 09:25
  • 1
    @hakra: Well, if you would honestly say that "a short article can *include* a 10000-word paragraph" then I won't argue the point further. – antinome Aug 16 '12 at 13:22
  • 9
    tl;dr: An MIT-licensed app can include GPL code but the resulting app is not MIT-licensed. – antinome Aug 17 '12 at 16:01
  • 1
    I have to agree with @antinome, mixing MIT and GPL can get quite tricky and I don't think the answer makes that clear enough. – irakli Sep 28 '12 at 14:31
  • @irakli: about what are you concerned about especifically when using MIT and GPL code together? What is tricky in your eyes? – hakre Sep 28 '12 at 14:35
  • @antinome: Your tl;dr is running very short: Neither is it only GPL. Read the MIT license carefully, there are some requirements. – hakre Jul 18 '13 at 11:46
  • 1
    @hakre which requirements are you seeing in the MIT license that are not in the GPL? – JosephH Oct 01 '13 at 20:19
  • @JosephH: All the requirements of the MIT license are not in the GPL. But I don't understand why you ask. – hakre Oct 01 '13 at 21:54
  • I'm not sure if the MIT License which is also called Expat should be considered free. It's prone to what GNU calls patent treachery. http://www.gnu.org/licenses/license-list.en.html#Expat – Jorge Orpinel Pérez Mar 17 '14 at 21:24
  • 1
    Much of this answer makes the tremendous assumption that the code will not be distributed. At minimum, this answer should state clearly when referring to code that is not distributed (the first part of the answer). Edit offered for consideration. –  Jul 24 '14 at 20:08
  • @TomDworzanski: The answer did not assume what you assume it would. With your edit you added an assumption which I prefer to keep out as it's biased and it does not help for the clarity of the answer. Especially as it's wrong. Distribution does not prevent from bringing GPL + MIT together. – hakre Jul 25 '14 at 10:05
16

You are correct that the GPL is more restrictive than the MIT license.

You cannot include GPL code in a MIT licensed product. If you distribute a combined work that combines GPL and MIT code (except in some particular situations, e.g. 'mere aggregation'), that distribution must be compliant with the GPL.

You can include MIT licensed code in a GPL product. The whole combined work must be distributed in a way compliant with the GPL. If you have made changes to the MIT parts of the code, you would be required to publish the source for those changes if you distribute an application that contains GPL and MIT code.

If you are the copyright owner of the GPL code, you can of course choose to release that code under the MIT license instead - in that case it's your code and you can publish it under as many licenses as you want.

JosephH
  • 37,173
  • 19
  • 130
  • 154
  • 3
    unless the project is under a dual license, for example jquery. – buggedcom Mar 08 '11 at 10:41
  • 7
    @buggedcom - You can dual-license the parts that were under the MIT license, but you can't dual license a combined MIT/GPL library - it must be licensed under the GPL only. (You can't take GPL licensed parts and re-license them under the MIT license, since that is against the GPL terms). In the case of jQuery, the copyright owners of the code released it under the dual license, so that's not a problem, but if they "borrowed" some GPL code from somewhere else, they would no longer be able to MIT license the combined work. – Mark H Apr 10 '11 at 13:38
  • AFAIK that's not quite true. According to the FSF the GPL is compatible with the MIT license [1] Unfortunately that does not change the fact that the project itself is no longer fully covered under the MIT license ...which is what people would usually expect. You would no longer be able to use the project as a whole in a commercial context without releasing the code. To avoid this confusion it's *better* to not include GPL code in a MIT licensed project. That you can't, is wrong though. [1] http://www.gnu.org/licenses/license-list.html#SoftwareLicenses – tcurdt Dec 31 '11 at 02:20
  • ...but I guess it depends on what you define as "product" – tcurdt Dec 31 '11 at 02:23
  • 2
    A MIT licensed product (perhaps 'application' would be better word) cannot include GPL code. You can add GPL code into a MIT product, but the resulting application can only be distributed under the GPL licence. I've never before seen someone describe an application that can only be distributed under the terms of the GPL as a 'MIT licensed product'. If the licenses were not "compatible" you could not produce a combined work at all - the fact that they are compatible means you can produce a combined work that you can distribute and is GPL licensed. – JosephH Dec 31 '11 at 10:59
  • The point is: if you include GPL licensed code - it's not an MIT licensed product anymore. The product can include GPL code - but then you cannot distribute it under the MIT license. There is a fine difference. If you were to change your answer to "You cannot include GPL code and distribute the combined work under MIT license" it would be correct - and match the answer I gave ;) – tcurdt May 24 '14 at 07:12
5

IANAL but as I see it....

While you can combine GPL and MIT code, the GPL is tainting. Which means the package as a whole gets the limitations of the GPL. As that is more restrictive you can no longer use it in commercial (or rather closed source) software. Which also means if you have a MIT/BSD/ASL project you will not want to add dependencies to GPL code.

Adding a GPL dependency does not change the license of your code but it will limit what people can do with the artifact of your project. This is also why the ASF does not allow dependencies to GPL code for their projects.

http://www.apache.org/licenses/GPL-compatibility.html

tcurdt
  • 14,518
  • 10
  • 57
  • 72
  • 1
    +1 In fact Microsoft pinpoint this problem perfectly, GPL is viral because it turns every project in open source. – magallanes Sep 14 '11 at 12:41
  • 10
    It's not a *problem*. GPL is viral by design. It's intended to be used by people who wish to make their code free for other people to use however they wish, but also require that other people *who publish copies of that software or a derivative* respect users in the same way. The GPL's about *users*. It's not about companies maximising profit through state enforced monopolies, so the fact that it's recursive is actually its beauty and strength, not a 'problem' that Microsoft can 'pinpoint perfectly'. It takes no special insight to recognise that the GPL is viral ~ Wikipedia is enough. – Carl Smith Oct 10 '13 at 13:58