21

According to the official GPL 2 FAQ, I have to use GPL for any project using a library under GPL (even if I don't directly use its sources), because my program links to the library.

But when I run an executable, I am using an operating system obviously. So do I have to use GPL for any project I am running on Linux? I think this does sound strange, but I can't explain to myself, what is wrong and why.

10
  • 2
    Which particular system library did you have in mind? Many system libraries are either LGPL licensed, or have a linking exception.
    – MadHatter
    Commented Aug 2, 2020 at 13:37
  • @MadHatter I don't understand the question... The question is not about libraries (the first paragraph is just a preamble) but about Linux
    – Kolay.Ne
    Commented Aug 2, 2020 at 14:11
  • 3
    @Kolay.Ne then I'm not sure what the question is about. It's can't be simply about running on on OS: free software can run on Windows, and proprietary software can run on Linux, and in both cases this is clearly fine, as it happens a lot. The licensing issues come when you link to other people's code in order to run: hence my question.
    – MadHatter
    Commented Aug 2, 2020 at 19:52
  • 6
    @peterh-ReinstateMonica No, it's not.
    – MadHatter
    Commented Aug 2, 2020 at 19:55
  • 1
    "Should you?" yes, there's lots of good reason to open source stuffs and contribute to the open source community; "Must you?" no, there's no legal obligations to publish any userspace software as GPL just because the software runs on Linux, even in the strongest case of GPL where what you ship is a hardware product or distro that contains Linux and your proprietary software. The most widespread interpretation (though not unanimous) is that the hardware/distro and other userspace programs in that situation isn't considered a derivative work. Only changes to the kernel need to be GPL-ed.
    – Lie Ryan
    Commented Aug 4, 2020 at 2:31

4 Answers 4

33

You don't have to publish your Linux software under the GPL. You are of course welcome to do so, but you are under no legal obligation.

You've taken a mental shortcut: “using a GPL library means I have to license under GPL”. But the GPL (and copyright law in general) doesn't care about what other software you use, but only whether your software is a derivative work of the GPL-covered software. For example, a software might be derivative if it is a modification of the original software, or if it includes the original software (in whole or in part). Using a library means linking the library, and the act of linking includes parts of the library in your program.

But when you write a software that runs on Linux, you are not including or modifying any part of Linux. Your software is not a derivative work of Linux. Thus, the license of the Linux kernel doesn't affect the license of the software running on it. (In fact, there is lots of software running on Linux that's completely incompatible with the GPLv2, such as Apache-2 licensed software or proprietary software.)

(For technical reasons the Linux kernel actually does inject the vdso pseudo-library into every running process as part of Linux' implementation of syscalls. But this is widely considered to be no licensing problem.)

Also, GPL does not mean that you have to publish your software. If your software is derivative of GPL-covered code and if you publish the software then the software as whole can only be licensed under the GPL. The GPL's requirements only trigger when you give a copy of your software to someone else.

10
  • 1
    Thank you for your answer! I find the second paragraph very good and general explanation, but just to be sure I want to clarify the following. I think, my app is a derivative work no matter whether I link a library statically or dynamically. In both situations, my source is a derivative work. Am I right?
    – Kolay.Ne
    Commented Aug 2, 2020 at 17:57
  • 5
    Probably worth mentioning that glibc (the standard C library that everyone links against) is LGPL, which explicitly permits dynamic linkage by anyone, while the X windows system (the graphical display system) is accessed in a way that is very much not creating a derivative work.
    – Mark
    Commented Aug 2, 2020 at 22:43
  • 3
    @Kolay.Ne In case of static linking the situation is clear, less so for dynamic linking. Different arguments: (a) Dynamic libs are entirely separate from software loading them. (b) A combined work is only created by end users, so no GPL concerns apply. (c) If a program is designed to load a lib, it's a derivative for all practical purposes. Most C/C++, programs include code from header files from the libraries they link anyway. LGPL is a GPL variant allowing linking with proprietary software, under conditions. Glibc is not strictly part of Linux, but a common component on Linux-based systems.
    – amon
    Commented Aug 3, 2020 at 10:44
  • 4
    Strictly speaking, unless you actually publish or redistribute your software, you don't have to put it under the GPL even if it's a derivative work of a GPL licensed work. Personal use doesn't mandate preservation of the license, just like personal use copies don't violate copyright law provided they're not being used by anybody but the person who made them. Commented Aug 3, 2020 at 12:00
  • 2
    "Your software is not a derivative work of Linux." - AFAIK, this is not true. If you write a program using specific implementation details of another program, your program might be a derivative of that program. However, you don't need to worry about Linux, because Linux comes with an exception for the GPL which specifically says you can write non-GPL Linux programs (more-or-less). Commented Aug 4, 2020 at 15:37
17

The linux kernel has a couple of exceptions from GPLv2. Namely the exception to not treat a syscall to the kernel as linking and the exception to allow non-GPL code to link to kernel-related services exposed via libc:

Syscall exception:

NOTE! This copyright does not cover user programs that use kernel services by normal system calls - this is merely considered normal use of the kernel, and does not fall under the heading of "derived work". Also note that the GPL below is copyrighted by the Free Software Foundation, but the instance of code that it refers to (the Linux kernel) is copyrighted by me and others who actually wrote it.

GCC exception:

In addition to the permissions in the GNU Library General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those programs without any restriction coming from the use of this file. (The General Public License restrictions do apply in other respects; for example, they cover modification of the file, and distribution when not linked into another program.)

Note that these exceptions are not applied to the entire kernel but only to specific parts. Which parts of the kernel has what exception is documented by a tagging system as described by the kernel licensing rules document: https://www.kernel.org/doc/html/v4.18/process/license-rules.html

In general it can be assumed that you can distribute any non-GPL userland software that run on linux. When distributing kernel modules (devices drivers) however you need to be a bit more careful which parts of the kernel you are interfacing with.

2
  • 3
    The syscall exception does apply to the entire kernel (from COPYING: 'The Linux Kernel is provided under GPL-2.0 WITH Linux-syscall-note. Being under the terms of the GNU General Public License version 2 only, according with LICENSES/preferred/GPL-2.0. With an explicit syscall exception.'). The old license wording explained it as: 'This copyright does *not* cover user programs that use kernel services by normal system calls - this is merely considered normal use of the kernel, and does *not* fall under the heading of "derived work".' Any other licenses must be compatible with this.
    – bain
    Commented Aug 3, 2020 at 20:22
  • Link to the file COPYING: github.com/torvalds/linux/blob/master/COPYING
    – 0 _
    Commented Nov 20, 2020 at 13:55
13

The official GPL FAQ, in the #PortProgramToGPL section, says

If I port my program to GNU/Linux, does that mean I have to release it as free software under the GPL or some other Free Software license? (#PortProgramToGPL)

In general, the answer is no—this is not a legal requirement. In specific, the answer depends on which libraries you want to use and what their licenses are. Most system libraries either use the GNU Lesser GPL, or use the GNU GPL plus an exception permitting linking the library with anything. These libraries can be used in nonfree programs; but in the case of the Lesser GPL, it does have some requirements you must follow.

Some libraries are released under the GNU GPL alone; you must use a GPL-compatible license to use those libraries. But these are normally the more specialized libraries, and you would not have had anything much like them on another platform, so you probably won't find yourself wanting to use these libraries for simple porting.

Of course, your software is not a contribution to our community if it is not free, and people who value their freedom will refuse to use it. Only people willing to give up their freedom will use your software, which means that it will effectively function as an inducement for people to lose their freedom.

If you hope some day to look back on your career and feel that it has contributed to the growth of a good and free society, you need to make your software free.

(The GPL 2 FAQ you link to has word-for-word the same text in its corresponding section ).

1
  • 1
    If you want something directly from the people who wrote the kernel, in addition to the people who wrote the kernel's license, you might also find this file of interest.
    – Kevin
    Commented Aug 3, 2020 at 4:51
5

According to the official GPL 2 FAQ, I have to use GPL for any project using a library under GPL (even if I don't directly use its sources), because my program links to the library.

This is correct. But you go on to ask a very different question, "...do I have to use GPL for any project I am running on Linux?" Running a program on the GPL'd Linux kernel is not linking the program to a GPL'd library; other answers have explained how this works.

That said, if you port a program to Linux you will most likely be linking against libraries commonly distributed with Linux, and here you must be aware of the license for each library you decide to use. The GNU C Library, a popular libc implementation, is under the LGPL so there are no issues there. But some other commonly used libraries, such as readline, are under the GPL and linking to them (including dynamic linking) would require you to relicense your whole work under the GPL. (This is one of the primary reasons that there are serveral API-compatible alternatives to readline.)

2
  • Is there something special about the readline library forcing me to license my work under GPL even when dynamically linking or there is some general rule when I have to treat my work as a derivative from a library which I dynamically link?
    – Kolay.Ne
    Commented Aug 5, 2020 at 10:37
  • 3
    @Kolay.Ne There's nothing special about readline. As far as I'm aware the opinion of the Gnu folks is that dynamic linking to any GPL'd library requires you to GPL your program. (If the library author didn't want to force clients of the library to be GPL'd he would have put the library under LGPL; that's what it's there for.) Also, keep in mind that dynamic linking is not so different from static linking: in both cases you end up with a single memory image containing all the program and library code. They are just combined at different times.
    – cjs
    Commented Aug 5, 2020 at 10:44

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.