45

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

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,410
9

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."

3

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
  • 163