4

I am an author of a non-GPL code that is distributed under an Apache license. There is a GPL2 library (not LGPL) that many users will commonly want to link to that provides part of our algorithm, but our repository does provide a default for the same functionality and links fine without it.

I'm trying to figure out a standard for separation. Is it OK for users to obtain and use the library? Does it matter that our code anticipates this through hooks commented out with macros or the build system? Does it matter if obtaining the code is facilitated, either using GitHub with submodules or cmake with FetchContent?

  • 1
    Can you clarify which GPL library is concerned? It makes a big difference if the license is "GPL v2 only" or "GPL v2 or later" due to compatibility issues with the Apache license. – Bart van Ingen Schenau Sep 19 at 18:10
  • I don't know much about it, but JULIA employs a USE_GPL_LIBS flag to use or exclude GPL libraries (discourse.julialang.org/t/…). It's worth a closer look at how their code is structured and licensed. – apsillers Sep 19 at 20:18
  • Does the hook (whether commented out or not) contain or is it derived from actual GPL code? Simply "referring" to some other code is not the code itself and does not generally require permission. This is similar to writing a book where you refer to some other other book (which is copyrighted). You do not need permission to do that. – Brandin Sep 20 at 5:45
  • @Bart van Ingen Schenau Oddly, I can't clarify easily without some research. What happened was that the owner of the library copied the license and the template for the notice into the COPYING file for GitHub, but did not fill out the template or add notices to source files. It is the version 2 template. – Eli S Sep 21 at 5:41
  • @Brandin Thank you for this clarification. We include a call to their routine with our arguments. I wouldn't consider it "contain" or "derived" other than that. – Eli S Sep 21 at 5:43
1

Firstly note that while linking to a GPL library means you have to comply with the GPL terms, that doesn't mean that your code has to be licensed under the GPL, only that the license you use cannot prevent users complying with the GPL terms. This is where GPL compatible licenses come into play, which includes Apache 2.0 and Modified BSD (3-clause). Note in the compatible licenses list, that the version matters, you will see that Apache 2.0 is compatible with GPLv3 but not GPLv2, also the BSD mentioned is the modified BSD license which has no advertising clause, so be sure to look closely at what is used when looking at compatible licenses.

From the examples I have seen, it is considered a matter of what code is compiled/linked into the final binary rather than the method of retrieving the code that is used. I would suggest using a build option or only searching for installed libraries rather than making your build system download and build the libraries, that leaves it to the user to install and enable the use of the GPL libraries.

An example to look at would be the eigen library, where older versions were released under LGPL, it is moslty licensed under MPL now. It uses the preprocessor symbol EIGEN_MPL2_ONLY to not compile LGPL licensed code into the library. See example in v3.3 src/OrderingMethods/Ordering.h.

Similarly the quadriflow project using eigen has a build option to only use eigens MPL algorithms, you can see in src/optimizer.cpp that it chooses different classes based on the licensing choice.

  • I agree, but have to point out that Apache 2 is not compatible with GPLv2 – amon Sep 21 at 11:05
  • @amon, yes, an easy point to overlook. – sambler Sep 22 at 3:25
  • If you distribute code which is linked to GPL code, then the opinion of the FSF is that you do, indeed, have to distribute the package in its entirety under GPL (see eg GPLv2 s2b, GPLv3 s5b). We have questions here that argue both for and against their position, but you seem in your first sentence to be suggesting that it's a done deal that the FSF is wrong, and without any further justification it's difficult to see how you can do that reliably. – MadHatter supports Monica Sep 23 at 7:07
  • @MadHatter I am not saying the FSF is wrong, I say that the license you use must not conflict with or prevent following the terms of the GPL. Yes the package as a whole would be considered a GPL package, but that doesn't mean your code has to be GPL. I am not commenting on the final package distribution, only the code internal to the project, and as in the example projects I give, if you deliberately do not use the GPL code from a library with GPL and non-GPL code, there appears to be some agreement that the end package can be non-GPL. – sambler Sep 24 at 3:49
  • The FSF put a different interpretation on it, see their FAQ: you may release your code separately under a more permissive licence, but when it's being distributed as part of a larger work "the whole combined program has to be released under the GPL". – MadHatter supports Monica Sep 24 at 5:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.