44

Okay, before everyone goes shouting about duplicate questions, yes, I've already seen several questions like this here. But none answer the question.

If I link against a GPL-ed library without modifying that library, do I need to release my source code?

According to this question, the answer is yes!

But this answer is not satisfactory to me. The answer basically says that I cannot use GPL code in any way without making my code open source.

But if the previous is true then that would indicate that no person or organization could ever release any proprietary software on Linux ever. Which must be wrong. Simply because in order for any application to do anything useful, open files, write to the console, create TCP connections, the application must be linked to libc which is GPL-ed.

So my question is this: If the GPL states, as all the previous answers on the site say it does, that a program which links to another GPL program must be GPL itself, how is it possible to create/release/sell any proprietary application at all which runs on Linux? Since as I described above that application must be liked to GPL code just to run on Linux.

A more practical example say I link to a shared library which is GPL-ed in a non-GPL application, would that force the non-GPL application to become GPL-ed? More specifically if I use a GPL library without modifying it, and then distribute that library as an .so or .dll, would that require my application be open source?

wonea
  • 141
  • 7
john-charles
  • 668
  • 1
  • 6
  • 6
  • 13
    You keep asking the same question in the hopes of a different answer. You cannot use GPL in non-GPL compatible software. Dead simple. – Andrew T Finnell Jul 31 '12 at 00:57
  • 2
    Does he really? Blimey. The answer is simple; why don't you get in touch with the authors of the GPL program and ask if they mind? If they say it's fine that's grand! If they object, then trying to strong-arm them with legal details is going to make you very very unpopular, no matter how "right" you feel you are. – James Jul 31 '12 at 07:56
  • 5
    @James: If they chose GPL, it is pretty strong statement they *do* mind. People who don't mind choose MIT or BSD or LGPL in the first place. It's very rare to see a library under full GPL. When you do, you can be almost certain it was intentional. – Jan Hudec Jul 31 '12 at 09:43
  • @Jan Maybe, depends on the app and john-charles intended use. But I just think it's odd how J-C is approaching this. Is j-c just trying to get the answer he wants? There are many questions on this site that could be resolved with a "just talk to them, for crying out loud". :-) – James Jul 31 '12 at 10:19
  • @JanHudec: I agree. I've argued to release some of our company's IP in the form of a GPL'ed library, since that would be essentially useless to our competitors and still very useful for our community. – MSalters Jul 31 '12 at 12:08
  • #MSalters interesting! – john-charles Jul 31 '12 at 16:10
  • You have consider this, if you use a GPLed library to create a program, you are creating a derivated work, so your code must be GPL. Only if are different programs, you can no license GPL, take a look to the GNU FAQ http://www.gnu.org/licenses/gpl-faq.html#GPLInProprietarySystem – vgonisanz Mar 08 '16 at 12:08

3 Answers3

40

If you link to a GPL lib then you have created a derived work and your code must be GPL - this is different to LGPL code which specifically allows dynamic linking of differently licensed code. The system libraries including libc, are all LGPL.

There is also a special exemption for the Linux kernel headers and libgcc (the library implicitly called to by the compiler).

Jan Hudec
  • 18,250
  • 1
  • 39
  • 62
Martin Beckett
  • 15,776
  • 3
  • 42
  • 69
  • So your saying any commercial application which runs on Linux has to completely re-implement libc? Note that lib c includes thing which are not kernel calls such as strcpy, and other similar functions. – john-charles Jul 30 '12 at 22:27
  • 19
    No libc is LGPL - you are allowed to link to LGPL programs. There is also a general exemption for kernel/system calls so there is no argument abotu what is a system vs library call – Martin Beckett Jul 30 '12 at 22:28
  • What about a few years ago, when gpl v2 was the only license available? I know back a long time ago companies were offering software which ran on Linux even if it wasn't that common. – john-charles Jul 30 '12 at 22:30
  • 6
    LGPL is not a new license, it was first released in 1991. libc has always been LGPL. – FigBug Jul 30 '12 at 22:34
  • 5
    @john-charles - that's why LGPL was invented back in 1991 with gplv2. AsLinux (and others FOSS kernels) became popular - and is why it was originally called the Library-GPL - there was a fear that there would be a profusion of libc by every compiler vendor if commercial apps couldn't use gcc. – Martin Beckett Jul 30 '12 at 22:35
  • 1
    @MartinBeckett This is the FSF opinion (you can't link to GPLd code if you don't license yours under GPL), however it's not undisputed. There hasn't been any major lawsuit (that I know of, if I'm wrong, please correct me) to confirm the FSF opinion on linking. – K.Steff Jul 31 '12 at 03:20
  • 1
    So it really seems to come down to the definition of a derivative work. This is all esoteric for me at the moment, but I suppose it would be for the courts to decide in the future. For example if company A used a GPL'd library as the basis for their expanded proprietary library that would clearly be a derivative work. But if company A uses the library in an unmodified form in an unrelated app A would be using it's features not creating a new work based on it. Like plugging in a light is not a deriving work of the electrician, I'm no expert but this debate has been enlightening! – john-charles Jul 31 '12 at 16:25
  • 2
    @john-charles - yes all common law gets tested in the courts, but there is quite a lot of case law on copyright. If I claim that my unmodified copy of a Batman DVD isn't a derived work and so I can sell as many as I want - the MPAA is unlikely to agree! The GNU copyleft uses copyright to enforce a license agreement in quite a clever way - one of the reasons it has never been tested in court is that everyone has always settled – Martin Beckett Jul 31 '12 at 17:40
  • I guess I see how that works! Hmm, interesting. – john-charles Aug 01 '12 at 23:41
  • what about using a GPL application into a batch so it produces some output several times? does that batch script CODE and the project that uses that batch have to be GPL too? or it have to be GPL just in case the batch is actually run in the final product at users machine; so, if it is run only at the developer machine, and the final product contains only the output generated by the GPL application (but not the batch script) then, the product is not required to be GPL? – Aquarius Power Dec 11 '14 at 22:46
  • 1
    @AquariusPower. No you can use GPL tools to create proprietry results just as you can use GPL compilers to generate commercial code. It is only derived if you dig into the GPL code and extract source/ideas, exactly the same as if you used bits of MS Word – Martin Beckett Dec 13 '14 at 19:04
  • 1
    thanks! also a bit different question but just to make me sure: and if I hardcode calls to GPL applications into a commercial java application, in a way that it requires the GPL applications to work on the user machine and produce outputs in realtime (but such outputs could be produced by hand on the command line by just calling the GPL application with its proper parameters), is it ok to the java application not be required to be GPL? – Aquarius Power Dec 13 '14 at 19:39
  • 1
    @AquariusPower well the correct answer is whatever the court decides! Calling a gpl program in a shell is generally OK - the whole idea of Unix is to use other small tools in your own. But creating an app which merely wraps some GPL lib merely to give it an interface to your closed so that you can release the wrapper while keeping your own app closed is obviously not in the spirit of the GPL. – Martin Beckett Dec 13 '14 at 20:09
  • 1
    That I was thinking, because using a GPL application (that is not a library) that way, would be like using it as it was a library... right? but the point is, it is not a library. I want to be an indie (bossless)game dev, but I need to know these things before I begin. – Aquarius Power Dec 13 '14 at 20:14
  • oh... my new question was actually about a link that is already at the OP! http://programmers.stackexchange.com/questions/47032/can-i-use-gpl-software-in-a-commercial-application – Aquarius Power Dec 13 '14 at 21:28
8

In the general case, you are correct in that you can't link to a GPL library, distribute your code, and then not release your code as GPL.

However, there is the System Library Exception which is how folks link against Linux libs and still release their product under non-GPL licenses.

Another exception is when the two licenses are compatible with each other. Check out the FSF compatible license page for further reading.

Finally, the authors of the GPL'd lib can create specific exceptions, such as for non-commercial or hobbyist use.

Unfortunately, there are too many potentialities to have a hard and fast rule. Without more specifics in your question, your answer is "probably can't, but maybe you can."

  • 1
    The SLE also answers a question of a program being a derived work of the compiler since it contains a parser generated by the compiler – Martin Beckett Jul 31 '12 at 03:09
  • 4
    No, SLE allows developing GPL code using non-free toolchain and standard runtime, e.g. Visual Studio. It does not allow linking non-free application with GPL library, ever. – Jan Hudec Jul 31 '12 at 09:31
  • 1
    The output of a GPL program is not covered by the GPL. See http://www.gnu.org/licenses/gpl-faq.html#GPLOutput – Maximus Minimus Jul 31 '12 at 10:49
2

The short answer is that nobody really knows. (This discussion is about GPL not LGPL.)

The GPL has vague language about "Derivative Works", which different people interpret in different ways. Consensus seems to be that static linking violates, but calling via system interrupts (e.g. to the Linux Kernel) does not. The latter is based mainly on the fact that companies like Oracle ship on Linux and have not been sued -- it is not clear in the license.

Dynamic linking is unclear, probably 70/30 say it violates. Calling a program using pipes or remote procedure calls, probably 70/30 say it does not violate, even though this essentially the same thing. Calling via COM, or using a Java Jar, is completely unclear.

Basically, if there is any doubt, and you do not like lawyers, then stay away from GPL.

Tuntable
  • 153
  • 2
  • 1
    GPL isn't really all that vague, and there's well discussed case law around the question of what is and is not a derivative work. The difference between the Linux syscall interface and libc is that the former is necessary to make working software (which has been affirmed as an exception to copyright) while the latter is not (you could implement your own). It has nothing to do with how the operations are invoked, which has no legal relevance.I ANAL, this is not legal advice. – Jules May 31 '17 at 19:10
  • "70/30 say it violates" and " 30/70 does not violate" - is it intentional that ratio of violate/does not violate is the same? "even though this essentially the same thing" suggests that it was intended to be different. – reducing activity Sep 29 '18 at 18:43