The various GNU licenses enjoy broad compatibility between each other. The only time you may not be able to combine code under two of these licenses is when you want to use code that's only under an older version of a license with code that's under a newer version.
Below is a detailed compatibility matrix for various combinations of the GNU licenses, to provide an easy-to-use reference for specific cases. It assumes that someone else has written some software under one of these licenses, and you want to somehow incorporate code from that into a project that you're releasing (either your own original work, or a modified version of someone else's GPLed software). Find the license for your own work in a column at the top of the table, and the license for the other code in a row on the left. The cell where they meet will tell you whether or not this combination is permitted.
When we say "copy code," we mean just that: you're taking a section of code from one source, with or without modification, and inserting it into your own program, thus forming a work based on the first section of code. "Use a library" means that you're not copying any source directly, but instead interacting with it through linking, importing, or other typical mechanisms that bind the sources together when you compile or run the code.
Skip compatibility matrix
|
I want to release a project under: |
GPLv2 only |
GPLv2 or later |
GPLv3 or later |
LGPLv2.1 only |
LGPLv2.1 or later |
LGPLv3 or later |
I want to copy code under: |
GPLv2 only |
OK |
OK [2] |
NO |
OK if you convert to GPLv2 [7] |
OK if you convert to GPLv2 [7][2] |
NO |
GPLv2 or later |
OK [1] |
OK |
OK |
OK if you convert to GPL [7] |
OK if you convert to GPL [7] |
OK if you convert to GPLv3 [7] |
GPLv3 |
NO |
OK if you upgrade to GPLv3 [3] |
OK |
OK if you convert to GPLv3 [8] |
OK if you convert to GPLv3 [8][3] |
OK if you convert to GPLv3 [7] |
LGPLv2.1 only |
OK if you convert to GPLv2 [7] |
OK if you convert to GPL [7][2] |
OK if you convert to GPLv3 [8] |
OK |
OK [6] |
OK if you convert to GPLv3 [8] |
LGPLv2.1 or later |
OK if you convert to GPLv2 [7][1] |
OK if you convert to GPL [7] |
OK if you convert to GPLv3 [7] |
OK [5] |
OK |
OK |
LGPLv3 |
NO |
OK if you upgrade and convert to GPLv3 [7][3] |
OK if you convert to GPLv3 [7] |
OK if you convert to GPLv3 [8] |
OK if you upgrade to LGPLv3 [4] |
OK |
I want to use a library under: |
GPLv2 only |
OK |
OK [2] |
NO |
OK if you convert to GPLv2 [7] |
OK if you convert to GPLv2 [7][2] |
NO |
GPLv2 or later |
OK [1] |
OK |
OK |
OK if you convert to GPL [7][1] |
OK if you convert to GPL [7] |
OK if you convert to GPLv3 [7] |
GPLv3 |
NO |
OK if you upgrade to GPLv3 [3] |
OK |
OK if you convert to GPLv3 [8] |
OK if you convert to GPLv3 [7][3] |
OK if you convert to GPLv3 [7] |
LGPLv2.1 only |
OK |
OK |
OK |
OK |
OK |
OK |
LGPLv2.1 or later |
OK |
OK |
OK |
OK |
OK |
OK |
LGPLv3 |
NO |
OK |
OK |
OK |
OK |
OK |
Skip footnotes
1: You must follow the terms of GPLv2 when incorporating the code in this case. You cannot take advantage of terms in later versions of the GPL.
2: If you do this, as long as the project contains the code released under GPLv2 only, you will not be able to upgrade the project's license to GPLv3 or later.
3: If you have the ability to release the project under GPLv2 or any later version, you can choose to release it under GPLv3 or any later version—and once you do that, you'll be able to incorporate the code released under GPLv3.
4: If you have the ability to release the project under LGPLv2.1 or any later version, you can choose to release it under LGPLv3 or any later version—and once you do that, you'll be able to incorporate the code released under LGPLv3.
5: You must follow the terms of LGPLv2.1 when incorporating the code in this case. You cannot take advantage of terms in later versions of the LGPL.
6: If you do this, as long as the project contains the code released under LGPLv2.1 only, you will not be able to upgrade the project's license to LGPLv3 or later.
7: Every version of the LGPL gives you permission to relicense the code under the corresponding version (or any later version) of the GPL. If you can switch the LGPLed code in this case to using the GPL instead, you can make this combination.
8: Every version of the LGPL gives you permission to relicense the code under the corresponding version, or any later version, of the GPL. In these cases, you can combine the code if you migrate its license to GPLv3, and use GPLv3 for your own work as well.