I have found a GPL library (no dual license), which does exactly what I need. Unfortunately, the GPL license on the library is incompatible with the license of a different library I use. I have therefore decided to rewrite the GPL library, so the license can be changed.

My question is: How extensive do the changes need to be to the library in order to be able to change the license? In other words, what is the cheapest way to do this?

  • 5
    It may be cheaper to pay the author of the GPL library to release it to you under a different license.
    – quant_dev
    Commented Jun 6, 2011 at 6:09
  • 3
    Rather than ask what's the CHEAPEST way, why not tell us the full story and ask "What's the right thing to do?" Commented Jun 19, 2012 at 21:49
  • 5
    If the other library is not compatible with GPL, perhaps that is the library you need to change. Commented Jun 20, 2012 at 7:23
  • 1
    What license does the other library have?
    – Andres F.
    Commented Jul 17, 2013 at 13:25

9 Answers 9


I'm not a lawyer, but AFAIK if you have seen the GPLed library code any emulation library you write would be tainted and may be declared a derived work by a judge if it is too similar in his appreciation.

So the process would be to write a functional spec and have someone which hasn't seen the GPLed code write the library.

Edit: Note that with the way you formulate your question "How extensive do the changes need to be to the library in order to be able to change the license?" the answer is AFAIK clear: whatever you do, if you just modify the library you must respects the term of the license which makes you able to modify it in the first place.

  • 3
    The tainting issue is probably not a very serious concern in practice. In cases where you're reverse-engineering a commercial entity's code, then the firewall between the reader and the implementer is necessary for the (essentially inevitable) infringement lawsuit, so you can show that the was no possibility of copying code from the other version. In the case of most GPL code, unless you're blatantly infringing nobody's going to sue you, since it's not in their interest to do so. Commented Jun 5, 2011 at 23:07
  • 1
    You may like Russian roulette, its your choice. If for any reason -- competition inheriting the code in a way or the other, or just competition deciding to finance the lawsuit -- you are sued and convicted, its something which may drown your company. Even if you are not sued, if it is known the bad reputation may be a problem. Commented Jun 6, 2011 at 8:09
  • 2
    I think the "tainted" issue mostly applies to NDAs. For copyright issues, it hardly makes sense. Consider that copyright also applies to books, newpapers, movies etc. George Lucas probably saw the Star Trek series on TV before creating Star Wars, does that make Star Wars a derivative work? If a newspaper reporter hears about something on radio, does that prevent him from writing about the same event?
    – user281377
    Commented Jun 6, 2011 at 8:37
  • 7
    Clean room approach is just a way to prove that you haven't infringed copyright law. As I understand it -- and again I'm not a lawyer -- things developed without knowledge of the original work may not infringe copyright (but may infringe patents). Things developed with that knowledge may or may not infringe the copyright -- it is just harder to prove that similarities are due to random events or to the nature of the problem which make an approach natural. Commented Jun 6, 2011 at 8:49
  • 1
    @ammoQ: In the US, there was a copy infringement suit a long time ago (a statistical software package?) where a company was held to have infringed even though every line of code had been rewritten. Note that Star Wars isn't particularly similar to Star Trek, and that a newspaper reporter isn't going to write a story just from what he or she heard on the radio. Commented Jun 6, 2011 at 13:58

The usual way round this problem is to first contact the library's owner and ask if they will release it to you under a different licence.

If you're working on an open source project where the GPL is not compatible, then there's a good chance they'll do this, some projects end up with a GPL licence just because it seemed like the best choice.

Of course, this applies to both libraries. Getting the permissive licence dual-licences under a less permissive one shouldn't be a problem.

If you're working with a commercial product, then many library authors will give you a release under a different licence, if you compensate them appropriately.

  • 11
    It's worth a shot, but this does not work if the library's owner has accepted or made use of GPLed contributions, which is the case for many libraries.
    – Brian
    Commented Jun 19, 2012 at 21:01
  • ^ Unless they had a "contributer's" agreement which reassigned copyright back to the original authors: softwareengineering.stackexchange.com/a/225577/93511
    – Jonathan
    Commented Mar 6, 2019 at 20:08

My understanding is that if you start with a work and modify it, no matter how extensive the modifications, the final result is a derived work of the original. You will need to write the library from scratch. If you write the library from scratch, but have seen the code, then if it is too similar you can again be sued for copyright infringement.

These rules are not specific to software, they apply to copyrightable things of all kinds.

I am not a lawyer, and this is not legal advice. I am also quite possibly not in your jurisdiction, and you should always be dubious of legal advice offered on the Internet. If you wish to have reliable legal advice, you'll need to pay a lawyer.


IANAL, but I do know that in the USA, no degree of modification will create a non-derivative work. If it has any code copied from the old library or it has enough internal similarity that it would get you in trouble for plagiarisim in a University class, then you are no-where near a new work. Changing some names of functions or variables won't do anything, neither will moving chunks of code around in the source. You would have to independently re-create it to even stand a chance. IOWs, you'd need to look only at the interfaces that it provides, and decide how to provide that functionality and re-create it that way to stand a chance. Even then you still might not be out of the woods if someone really cares and gets mad.

In the end, your best bet is to contact the author of the library and hope that you can find an arrangement for more permissive licensing of he library.


If everything else suggested here (asking for double license, rewriting) is not acceptable, please remember that it is still not a clear case whether or not dynamic linking with proprietary program/library is considered derivative work. FSF says it is, but many lawyers (Lawrence Rosen included) have questioned this.

So you can link your software with GPLed library, then make sure source code for it is distributed with every copy of your software. If anybody sues you, they have to prove, that their understanding of this tricky and murky GPL aspect is correct. As it appears (eg. Galoob vs Nintendo) you can't be absolutelly sure what makes derivative work and what doesn't.

  • or at least ask if the lib can be LGPL as well.
    – Johan
    Commented Jun 6, 2011 at 11:07
  • 2
    The dynamic linking issue is a difficult one, but don't count on a judge ruling your way. The judge might well rule that you accept the Gnu definitions if you use the Gnu license, and you probably don't want to base your software product on the outcome of a court case that hasn't happened yet. Commented Jun 6, 2011 at 14:04

The only way it would not be derived work, would be if you'd rewrite whole code yourself without using any of the original code. Which is probably infeasible.

There are much easier ways around GPL:

  • in the clear: make it into service, access it through a socket. Socket is a boundary to GPL license (unless it's infamous GPLv3 with Affero clause);
  • in the gray zone: dynamically link it. There is lot of controversy if dynamic linking is or is not boundary to derived work. Few points of view here. This might also depend on jurisdiction you're in.

Also note, that GPL is distribution license, so you only need to license your work if you distribute binaries to third party. And you're only obliged to release source to them, no obligation to release it to general public, unless you release binaries to general public. If you're using your code for example only on your servers, you have no obligation to release any code. This is how for example Google does it with their tweaked Linux kernels.

  • I'm far from sure that socket is a barrier. According to our lawyers, engineers are too focused by technical measures while the global effect is what is checked by the law. Publishing a socket interface and giving an example use in emacs lisp was OK for them. But giving the possibility to automatically install emacs along with our program wasn't. You are right for the distribution. But note that you can't prevent the one to whom you distribute to distribute further. Commented Jun 6, 2011 at 9:51
  • @AProgrammer: even FSF says, that if it's separate process, then these are separate programs, thus not derivate work. FAQ's about the plugins, but the logic still applies: gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins
    – vartec
    Commented Jun 6, 2011 at 9:56
  • The question is about plug-in and plug-in are per nature not indispensable. I wouldn't bet my company that structuring a program in two processes, one GPLed because it used GPLed libraries the other not because we want to keep the source private is legit. Especially when both are distributed together. But that's your call. Commented Jun 6, 2011 at 11:26
  • 1
    @A: distribution with other programs is "aggregation", and explicitly allowed by GPL. And no, that's not my call. Personally, I wouldn't touch GPL library even with 10-feet long stick.
    – vartec
    Commented Jun 6, 2011 at 11:34

IANAL and, in any case, this may mean nothing legally, but, I believe that in Steven Levy's book "Hackers", he describe how, at one point, RMS wrote *nix code for money during the day and at night wrote the same stuff at home so that it could be part of... GNU?... this was before Linux... some free Unix type system. I believe that he had to make the home-code different than the day-code, but he was basically doing exactly what you are suggesting.

This probably doesn't matter legally, either but... I am not sure whether Apple and/or Microsoft got permission/license or something, but didn't bell labs invent the desktop/icon/mouse interface, which was used for Macs (or Lisa?) which was then used by Microsoft.

  • That would be Xerox PARC, not Bell Labs. Commented Feb 18, 2014 at 16:02
  • And Jobs made a deal with Xerox that allowed Apple to go see the lab in Palo Alto. Nobody at Xerox cared about that tech at the time. Commented Dec 4, 2014 at 7:33

There is no answer to this except for a trial before a judge in your particular jurisdiction. But do you want to risk it? Or go to the effort of re-writing the GPL library, the tests etc. etc. Are you sure the other library is incompatible with the GPL? This is actually quite unusual, unless you want to distribute both libraries under the non-GPL libraries terms.

  • You can get the Gnu list of licenses at gnu.org/licenses/license-list.html and you will notice that it's divided into free GPL-compatible licenses, free non-GPL-compatible licenses, and nonfree licences. The GPL has some specific requirements that other licenses frequently don't conform to, and one of the goals of GPLv3 was to make compatibility easier. Commented Jun 6, 2011 at 14:01

How extensive do the changes need to be to the library in order to be able to change the license?

In most parts of the world you need to start from scratch and not cut and past anything. You need new names for functions/classes/variables etc etc, and the structure should be different. Then you are safe.

On the other hand, if a diff-tool can't find any similarities then...

  • 2
    If a diff tool can't find any similarities then it still may be a copyright infringement. Look at it from a non-programming viewpoint: I write a book, you translate it into Swedish, and by US (and likely Swedish) copyright law you made a derivative work. Commented Jun 6, 2011 at 14:08
  • @David Thornley Yes, you are right about derivative work.
    – Johan
    Commented Jun 6, 2011 at 15:13

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.