Using an unmodified GPL library in non-copyleft code

I am writing a piece of software that I plan to distribute. In my code, I use a GPL licensed library. Do I have to apply the GPL to my software even if I did not do any changes to the above mentioned GPL library? Or would this condition trigger only in the case of its modification?

5,680 26 26 silver badges 55 55 bronze badges asked Nov 30, 2021 at 15:31 89 1 1 silver badge 2 2 bronze badges

2 Answers 2

As a add-on answer to amend what @amon explained in his answer:

That is the point of releasing a library under GPL: Any program which wants to make use of it also needs to be distributed under terms of the GPL.

For most practical purposes, a ready-built program is always a derivative of the libraries it makes use of and thus the distributed binary must fulfill all conditions of all libraries it uses. And it is often a good idea if the same is true for the source code.

If the authors of a library did not care about GPL for programs using it, but only the terms for the library itself, they would have chosen the LGPL or in some cases the GPL with a linking or class path exception as their license.

answered Nov 30, 2021 at 17:10 planetmaker planetmaker 11.5k 1 1 gold badge 29 29 silver badges 50 50 bronze badges

Thanks for the answer, to both of you! I understand this concept when we are talking about libraries. Let me follow up with a more specific example - MongoDB. It is now licensed under SSPL (source-available version of AGPL 3.0). Even in this case the same logic applies? Just to be clear - I will not modify the MongoDB source code, I will just use it as-is in my software.

Commented Dec 1, 2021 at 14:00

re GPL licences it does not matter if you modify the MongoDB source code or not, It depends on how you use it. (Only LGPL distinguishes between modification of a library's source code and use of the library)

Commented Dec 1, 2021 at 16:19

@Jakub: The SSPL is not the GPL, and for that matter it is not an open source license at all. Questions pertaining to the GPL may not be applicable to the SSPL, because they are entirely different licenses.

Commented Dec 1, 2021 at 23:12

@Jakub it depends on how you're using it. The following sentence is only true if you're not allowing others to directly connect to MongoDB that you host by exposing port 27017 and giving out credentials—if you give a bundle of programs for others to host which includes MongoDB, this may be different. You're very likely using a library to connect to MongoDB in your program, in which case your program is subject to the library's terms, because the network interface separates MongoDB and your program into two separate works for copyright purposes.

Commented Dec 2, 2021 at 2:17

In the opinion of the FSF, you could only distribute your software under the terms of the GPL. Your software as a whole includes the GPL-covered library and is thus derived from the library.

The GPL triggers conditions both on modification and on distribution. But modification is not just about editing the library's source code. The GPL-3.0 defines:

To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.

Your software can be considered to be a work based on the GPL-covered library and is, for all practical purposes, a modification.

There have been lengthy debates over whether this argument still holds if the library is dynamically linked, or if the software is not compiled. There are people who argue that the GPL might not apply to your program. But it's safer to assume that the GPL does in fact apply.

If the GPL applies to your software as a whole, this doesn't mean that every component must use the GPL license. Components could also use compatible licenses. So you wouldn't have to license your source code under the GPL terms, and could instead choose a compatible open source license.