39

If I'm using a library that is licensed under GPL v3 in my project, can I license my project under the MIT license? I tried to read the GPL v3 text but I cannot understand it without your assistance.

3 Answers 3

33

No; incorporating or linking against GPL requires that your project-as-a-whole be distributed under GPL. But you can include MIT licensed parts (or another GPL-compatible license) in the project. Also, it depends.

The pertinent clause is 5 (c):

c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.

So if GPL-licensed code ever gets included in your project, for example via linking against a GPL'd library, you must also provide your whole project under the GPL.

There's some disagreement on whether GPL comes into play when a library is dynamically linked; GNU are of the opinion that it does, and provides the alternative license LGPL, or recommends adding exceptions to GPL.

However, you can still license parts of your project under MIT, you just need to make sure the MIT and GPL sections are clearly separated. SFLC have published this document on how permissive and GPL code can be mixed in a project. This means that the MIT portions can be shared under that license, but if the whole project is distributed, it must be under GPL.

6
  • Thank you. Does not the entire work, as a whole that you cited prohibits licensing parts under MIT? Commented Aug 20, 2015 at 8:29
  • @zespri no. That you license the entire project under GPL doesn't mean you can't also license parts of the project MIT.
    – Martijn
    Commented Aug 20, 2015 at 8:35
  • @Martijn, sorry I do not understand. That would mean that people will need to comply to both licenses, which does not make practical sense. Commented Aug 20, 2015 at 9:06
  • 1
    @zespri People can use the combined work including the MIT licensed content under the GPL. People can also use the MIT licensed content under the MIT license. Because the MIT license has no restrictions that the GPL doesn't forbid, the MIT license is said to be "GPL compatible", and this construction is possible. A reasonable follow-up question could be "What does GPL compatibility mean"
    – Martijn
    Commented Aug 20, 2015 at 9:14
  • 1
    Linking against GPL-licensed code does not require to license the project as a whole until you effectively link and run. Commented Oct 4, 2016 at 11:38
13

If I'm using a library that is licensed under GPL v3 in my project, can I license my project under the MIT license? I tried to read the GPL v3 text but I cannot understand it without your assistance.

Yes, I can use the MIT license. This is my own code and I can use any license I please. (I assume I am not copying any GPL-licensed code in my MIT-licensed library). Furthermore, the MIT license is considered by the Free Software Foundation as compatible with the GPL and LGPL licenses (all versions). There are plenty of examples of MIT-licensed code used in combination of GPL-licensed code, for instance in the Linux Kernel.

But I would need to consider what happens in these two cases:

  1. at rest, my source code is MIT-licensed (assuming there is no GPL-licensed code copied in it). As long as I do not run nor build the code there is no GPL in play.

  2. when built or at runtime my code eventually interacts with the GPL library I depend on. What happens is technology specific here: it may be C code that is statically or dynamically linked with the GPL-licensed library. Or is could be Java, Ruby or Python code that imports or requires the GPL-licensed package.

What matters is how my code does interacts and depends on the GPL-licensed library at build and/or runtime. I can check this answer (disclosure: I wrote it) for some background on interactions and dependencies. If I redistribute binaries and my code is combined with the GPL-libraries in a certain way, my code may be subject to the GPL source code redistribution requirements. The same would apply to user of my source code: when they build it, the combined binary may be come subject to the GPL terms for instance if my code is itself a library, the GPL may extend at runtime through my library to my users' code.

Since in the end what matters is eventually running code (vs. source code at rest) even though my code may be MIT-licensed, I would clearly state to my users that when built the code is combined by default with GPL-licensed code and that the GPL terms may apply.

Alternatively a user could replace or remove the GPL-licensed library dependency from my code and it would not be combined with the GPL-licensed any more and only the MIT would apply.

As a practical example of a project with such a policy consider FFmpeg. It's overall license is the LGPL (and not the MIT, but from the point of view of the GPL the results are the same). Depending on how FFmpeg is built and which parts are used when effectively building and running FFmpeg binaries (as opposed to just considering the source) the resulting licensing may be GPL.

FFmpeg is licensed under the GNU Lesser General Public License (LGPL) version 2.1 or later. However, FFmpeg incorporates several optional parts and optimizations that are covered by the GNU General Public License (GPL) version 2 or later. If those parts get used the GPL applies to all of FFmpeg.

7

No.

GPL is copyleft, meaning you have to distrubute any derivative works of the original also under the GPL. If you use a GPL library in your project, that creates a derivative work of the library, and your entire project has to be licensed under the GPL.

One exception: if it's the LGPL (Lesser/Linking GPL) then dynamically linking the library does not create a derivative and you're free to license how you want.

One caveat: you can also license your work under annother license. As long as people can get it under GPL, that satisfies the GPL requirements, and you can dual-license with MIT, for example. People can choose which license to follow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.