I'm writing a library and a tool on top of it, and I would like to release both under MPL-2. However, the library has an optional dependency, another library which is released under GPL (not LGPL).

I understand that the result of this combination will be under GPL, but I want to allow using my library and tool under conditions of MPL-2 if GPL-ed dependency is disabled.

What license should I apply to my source code and what headers should I add to my files?

  • Is it enough to release library and tool only under MPL-2?
  • Or should I additionally release under GPL every file?
  • Or should I additionally release under GPL only files that call functions from GPL-ed dependency?
  • Or should I additionally release under GPL my tool?

I would prefer single license (MPL-2) for all code, to keep things simple.

I've found this: Combining MPL-Licensed files with an (L)GPL-Licensed Project, and this:

You have a GPL'ed program that I'd like to link with my code to build a proprietary program. Does the fact that I link with your program mean I have to GPL my program? (#LinkingWithGPL)

Not exactly. It means you must release your program under a license compatible with the GPL (more precisely, compatible with one or more GPL versions accepted by all the rest of the code in the combination that you link). The combination itself is then available under those GPL versions.

I don't understand when the result of "combination" appears and when to apply GPL to MPL-ed work:

  • when I distribute source code that may use GPL-ed dependency?
  • when I distribute binaries with enabled GPL-ed dependency?
  • when someone builds my library and tool with GPL-ed dependency enabled?
  • when someone uses my library and tool with GPL-ed dependency enabled?

2 Answers 2


Licenses don't apply to individual instances of a product, but to the distribution of a product. If you don't in any way distribute or publish any GPL licensed code, then that license does not apply to you. You can design your library to work with a GPL library if the end user happens to have it, but you don't have to license yours under the GPL to do so. So you can license everything under the MPL.

  • Thanks! But if the license isn't applied to me at all in this case, doesn't it mean that I can legally distribute proprietary app that uses (links to or dynamically loads) some GPL library, and tell the user to install GPL library manually to make my app working?
    – gavv
    Dec 11, 2015 at 3:14
  • 1
    What I'm really interested in is why GPL in not applied here. Doesn't it contradict to e.g. #NonfreeDriverKernelLinux or #LinkingWithGPL? If not, could you explain how? E.g. it states that distributing Linux kernel driver (obviously without distributing kernel itself) violates GPL.
    – gavv
    Dec 11, 2015 at 3:36
  • 2
    @g-v There are competing theories about what constitutes a derivative work: see this pair of questions. The FSF have their own opinions, but they're not shared by everyone. I'm of the opinion that if you don't distribute any GPL-licensed stuff yourself then it essentially doesn't apply to you, especially if it's not essential for your project to function. Dec 11, 2015 at 3:44
  • 2
    @g-v Well if it is a derivative work then you just have to make yours GPL. No way around that. Dec 11, 2015 at 4:17
  • 1
    @g-v, it might technically be a GPL violation, but Linus set down the rules by which most (as in "all") Linux developers play, to consider this allowed use. If they don't sue, nothing happens as only the copyright holder can do so. Or consider is as a special dispensation in the kernel's license, just not written into it.
    – vonbrand
    Jan 16, 2016 at 0:54

Be careful, it could be claimed that by writing the user of the library you are using it's API, and creating a derivative work by that route. More clearly, if written e.g. in C and you #include some header file under GPL, the result depends on the header file. It will be hard to argue it isn't a derivative.

  • Do you know is this a problem when my code is under GPL-compatible license (MPL-2) and should I dual-license my code?
    – gavv
    Jan 17, 2016 at 13:08
  • @g-v, you might have to put it under GPL only. That is my point.
    – vonbrand
    Jan 17, 2016 at 13:30
  • Thanks, but again, doesn't it contradict to #LinkingWithGPL from GNU FAQ?
    – gavv
    Jan 17, 2016 at 15:12
  • @g-v, that is exactly the other way around, a GPL program using a non-GPL library. There is no (normal) way the library is built to work with the program, as you usually write the program against what the library offers.
    – vonbrand
    Jan 17, 2016 at 17:05

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.