28

In my understanding, the GPL prohibits static linking from non-GPL code to GPL code, but permits dynamic linking from non-GPL code to GPL code. So which is it when the code in question is not linked at all because the code is written in an interpreted language (e.g. Perl)?

It would seem to be too easy to exploit the rule if it was considered dynamic linking, but on the other hand, it would also seem to be impossible to legally reference GPL code from non-GPL code if it was considered static! Compiled languages at least have a distinction between static and dynamic linking, but when all "linking" is just running scripts, it's impossible to tell what the intent is without an explicit license!

Or is my understanding of this issue incorrect, rendering the question moot? I've also heard of a "classpath exception" which involves dynamic linking; is that not part of the GPL but instead something that can be added on to it, so dynamic linking is only allowed when the license includes this exception?

ekolis
  • 491
  • 1
  • 4
  • 7

3 Answers3

20

As for specific question regarding interpreted languages, GPL FAQ is very clear:

The interpreted program, to the interpreter, is just data; a free software license like the GPL, based on copyright law, cannot limit what data you use the interpreter on. You can run it on any data (interpreted program), any way you like, and there are no requirements about licensing that data to anyone.

As for generic question about dynamic vs static linking. First of all, FSF's and Stallman's view is that it doesn't matter if linking is static or dynamic, GPL infects either way. From FSF GPL FAQ:

If the program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single program, which must be treated as an extension of both the main program and the plug-ins. This means that combination of the GPL-covered plug-in with the non-free main program would violate the GPL.

and

Linking [name of your program] statically or dynamically with other modules is making a combined work based on [name of your program]. Thus, the terms and conditions of the GNU General Public License cover the whole combination

However, this is questionable from legal point of view. In the only case that actually went to court regarding dynamic linking — Galoob v. Nintendo — Court of Appeals ruled that derivative work "must incorporate a portion of the copyrighted work in some form". Which is not the case with dynamic linking.

Anyway regardless if dynamic linking does indeed infect or not, there is work around. It's used for example by Nvidia to provide binary drivers for Linux. You create (L)GPL wrapper, but as author you are allowed to add special exception to link with specific closed-source. Vide FSF GPL FAQ.

vartec
  • 20,760
  • 1
  • 52
  • 98
  • One of the natures of a derivative work is that it is not possible to cleanly separate out the original copyright holder's work. If Bob's `Foo()` is statically linked to call Joe's `Bar()`, to which copyright holder should the `CALL` instruction between them be attributed? Such interaction would be sufficient to constitute a "derivative work". If, however, Joe's work remains entirely within one file and Bob's remains entirely within another, the mere appearance of those files in different directories on the same disk constitutes aggregation, not derivation. – supercat Oct 06 '12 at 23:45
  • 1
    Creating an LGPL wrapper for a GPL library may allow you *also* to claim copyright on the combined work, but it absolutely does *not* give you the right to change the terms under which the original code was licensed. The original authors still hold copyright on the combined work, and they have to give permission if you want to add license exceptions. – the paul Sep 26 '13 at 22:37
  • @thepaul: thank you cpt. Obvious, but how does that relate to the question or the answer? – vartec Sep 27 '13 at 08:49
  • @vartec your last paragraph claims otherwise. – the paul Sep 27 '13 at 19:08
  • @thepaul: no it doesn't. FYI, Nvidia binary drivers are not GPL, the kernel is. – vartec Sep 29 '13 at 11:04
  • @vartec needless condescension aside, if it wasn't your intention to claim that you can get around GPL infection and link proprietary software to GPL software by means of an LGPL wrapper, you may want to edit your last paragraph. I can't find any other way to interpret it. – the paul Sep 30 '13 at 14:57
  • @thepaul: proprietary software, such as for example Nvidia binary drives is linked to GPL software such as Linux kernel. LGPL condom works in practice. – vartec Sep 30 '13 at 15:01
  • If by "it works", you mean some people do it and haven't been sued yet, sure. There's no firm legal answer to this yet, since it hasn't been tested in court, but the FSF certainly disagrees with this opinion. If, as they say, a linking wrapper of GPL'd software X constitutes a derivative work of X, the combination of X and the wrapper must be subject to all GPL requirements. – the paul Sep 30 '13 at 15:24
  • 3
    @thepaul: there already is a legal precedence which states that at least a part of copyrighted work must be included in a work to constitute derivative work. Beliefs of Stallman often have very little foundation in actual real law. – vartec Sep 30 '13 at 19:50
  • I'm aware of Galoob v. Nintendo, but there's no explicit statement about how that applies to software linking in general. In the Game Genie situation, Nintendo's interests were still honored (people were still buying Nintendo cartridges; the consumer still "paid Nintendo a fair return" in the words of the judge). That's not the case with your suggestion: the license on the original GPL code is simply being ignored completely. – the paul Sep 30 '13 at 22:36
  • And while Stallman is obviously kind of a kook, Eben Moglen's beliefs probably have significantly more "foundation in actual real law" than, say, @vartec's beliefs. – the paul Sep 30 '13 at 22:37
  • 1
    @thepaul: on one side you have legal practice used by 9 billion dollars company, on other claims by guy who likes to wear tinfoil hat. You claim that the later is more reliable, and you're entirely in your right to believe so. – vartec Jan 12 '14 at 16:08
  • And you're ignoring or not understanding my points, and mischaracterizing the situation. You're also entirely in your right to do so. – the paul Jan 13 '14 at 17:26
  • 2
    You quote the wrong part of [GPL FAQ is very clear](http://www.gnu.org/licenses/gpl-faq.html#IfInterpreterIsGPL). The part you quote is about **If a programming language interpreter is released under the GPL, does that mean programs written to be interpreted by it must be under GPL-compatible licenses?**! Hence the *to the [GPL-licensed] interpreter*. The relevant part is the last 2 paragraphs: *[...]Another similar and very common case is to provide libraries with the interpreter which are themselves interpreted. For instance, Perl comes with many Perl modules[...]* – Chris Wesseling May 18 '15 at 08:40
  • 1
    «The interpreted program, to the interpreter, is just data; a free software license like the GPL, based on copyright law, cannot limit what data you use the interpreter on. You can run it on any data (interpreted program), any way you like, and there are no requirements about licensing that data to anyone.» This is about running programs in any license even of a GPL interpreter right? Which doesn't cover the topic of using a non-libre plugin in a GPL program in an interpreted language. – tuxayo Jun 25 '18 at 10:08
  • I don't think the GPL FAQ is accurate on this matter. Dynamic linking does create a combined work, but in the case of dynamic linking, that combined work is created at runtime rather than compile time. Why is this relevant? Because this happens after distribution. The combined work is created by the end user in the process of running the program, and this combined work is never distributed, so the GPL's restrictions never come into play. – flarn2006 Sep 08 '19 at 04:51
5

Note: this is a legal question. Programmers.SE is not a legal forum, it's a programming forum. While the people here know quite a bit about programming, they don't know anything about the law. If you want to ask a legal question, you should ask that in a legal forum, where there are people who actually know something about the subject matter.


The GPL doesn't say anything about static or dynamic linking. It doesn't even say anything about linking at all. Every lawyer or judge I talked to says that the issue of static and dynamic linking is completely irrelevant.

Copyright is about creativity. Static vs. dynamic linking is a technical implementation detail. Whether or not something is statically or dynamically linked is not a creative act, it cannot possibly change the copyright status of a work.

In your question, you talk about "interpreted languages". But that term doesn't make sense: there is no such thing as an interpreted language. A language is an abstract set of mathematical rules and restrictions. A language isn't interpreted or compiled. A language just is. The term "interpreted language" is not just wrong, it is non-sensical. If English were a typed language, it would be a type error.

Interpretation and compilation are traits of the interpreter or compiler (duh!), not the language. Every language can be implemented with an interpreter, and every language can be implemented with a compiler. Most languages have both. Most modern language implementation even combine both in a single execution engine.

The Rubinius Ruby Implementation, for example, contains a static ahead-of-time compiler which compiles Ruby code to Rubinius byte code, an interpreter which interprets Rubinius byte code, and a dynamic just-in-time compiler which compiles Rubinius byte code to LLVM IR, which the LLVM infrastructure in turn compiles to native machine code. The MacRuby Ruby Implementation doesn't contain an interpreter at all, it compiles Ruby code straight to LLVM IR, then further to native machine code.

On the other hand, there are interpreters for C or C++.

All of this is just technical details. It is completely irrelevant to copyright.

It just doesn't make sense that whether or not someone violates someone else's copyright depends on whether or some third person chooses to run the program with an interpreter or compile it first.

The question is whether or not a work is derived from another work. It can be dynamically linked and still be derived, and it can statically linked and not derived at all.

Jörg W Mittag
  • 101,921
  • 24
  • 218
  • 318
  • What about interpreted "intermediate-code" languages? One of the principles behind the GPL is that anyone should be able to adapt the program to any reasonable machine which has the same language tools available as the original. If someone releases source code for an intermediate-code interpreter, along with a bunch of intermediate-form code that it can run, what would be the rules for releasing information related to that intermediate-code blob? Unlike compiled executables, which are machine-specific, the intermediate-code blob would be fully portable. – supercat Oct 06 '12 at 23:37
  • Sorry; I was going to ask on stackoverflow.com, and it suggested I ask here instead when I used the tag "gpl"! Is this sort of discussion banned here too? exec("killall -9 lawyer"); :D – ekolis Oct 08 '12 at 20:34
  • And yes, I agree that is makes no sense that an implementation detail should have no effect on the legal status of reuse; I just thought there was such a distinction and was asking for clarification! – ekolis Oct 08 '12 at 20:35
  • 4
    @ekolis: it's not banned, per se. It's just that it's not a good idea to ask legal questions of people who don't know anything about legal issues (like programmers, for example), when there are people who *do* know about legal issues (aka lawyers) you could ask instead. I have nothing against lawyers, quite the opposite. But I wouldn't ask one for algorithm advice, and neither would I ask a programmer for legal advice. – Jörg W Mittag Oct 08 '12 at 20:46
  • IANAL: It may be a technical detail, but it still makes a big difference, because it changes what is being distributed in a legally-significant way. With static linking, you're building a combined work which, according to the rules of the GPL, cannot be distributed outside the GPL. With dynamic linking, you might be doing this as well, e.g. if you package the libraries with your software in a ZIP file. But with dynamic linking, you can distribute it without the libraries, and it's 100% your work, even if it doesn't work on its own. And you can still, of course, offer the libraries under GPL. – flarn2006 Sep 08 '19 at 04:48
0

No idea how much truth there is in this, and IANAL, etc.; but in my interpretation, what is important is whether the library you link against is is in some form included in the "binary" (where "binary", in the case of dynamic programming languages, is just the source code as distributed; this is what I make of the FSF's definition of "binary" in this context).

So if you reference libraries from your code without including them in your distribution, I would consider this the equivalent of "dynamic linking", whereas if you bundle the libraries with your product, or copy-paste parts of the library into your own code, the "static linking" scenario would apply. This, at least, is in the spirit of the GPL: you can freely use (run, inspect, reference) the GPL'd software without restrictions, but as soon as you derive from it (by linking or copying parts of it into your own distributable product), it goes viral, and your software must also be GPL'd.

tdammers
  • 52,406
  • 14
  • 106
  • 154