I’ll describe the most common open-source software licenses for libraries or software you can find in the internet. If you’re ever planning to release your application to public, it’s important to know some basics about licenses, as costs of violating those are very high if you’d get sued. I’m also attaching my recommendations for usage of those licenses. Please not that I’m not a lawyer, I do not guarantee that statements in this post are correct.
Notable licenses
So, here are notable licenses, from the least to the most restrictive ones (for usage in commercial applications):
- Public Domain – you can do whatever you want with the code or its binaries published on this license, there are no limitations and you don’t even need to mention authors. That’s a good license for educational materials like tutorials or code snippets.
- MIT – no real limitations, you only need to include copy of its copyright notice with your software that states mostly about lack of warranty. This is a good license if you want to be credited for creating your software, but release it for free to everyone – both to commercial and open-source developers.
- BSD – there are few versions of it, but its usage is the same as MIT license. Only that some versions treat about not using authors to promote derived products (3-clause BSD/new BSD) or about forcing to include notice about authors in advertisments (4-clause BSD/old BSD). Usage of this license is very similar to MIT license, only that it imposes few more restrictions.
- LGPL (Lesser General Public License) – open-source license used mainly for libraries that allows you to link dynamically with its unmodified version without impact on licensing your software. In case of static linking, direct usage of library’s sources or modifications to the library, your software (or only the modifications made to the library) must be also released under LGPL (or optionally GPL) license. That’s called the copyleft virus – this license makes sure that the library will stay LGPL and nobody (except copyright holders) can make it closed-source in the future. Another restriction is that you must make code of this LGPL software available to everyone you distribute binaries to. This license is good for libraries that you want to be developed by open-source community, making sure that no company will take it over and starts releasing new proprietary versions of it (perhaps killing the original open-source development). This license has few downsides though – there are quite a lot of applications in which you can’t link libraries dynamically, for example in applications developed for iOS that go to Apple’s App Store.
- GPL (General Public License) – open-source license with the copyleft virus in its full form. Linking to or using source of GPL software in any way forces your own software to be GPL too. Also, like in case of LGPL, you have to provide sources of GPL software when distributing binaries. This license is primarily meant for applications, but some libraries also use it. It’s good for open-source application projects that are meant to be developed by open-source community. In case of applications, GPL doesn’t do much harm for commercial usages, but using it for libraries is entirely different. It effectively shuts off most of commercial usages, as commercial developers will usually have to just use another non-GPL library with similar functionality or write they own one.
Note: there is a GPL linking exception clause that some libraries use to maintain their code open-source (GPL), but at the same time allow linking (static or dynamic) them to your software under license of your choice. This works like LGPL, but is less restrictive in terms of allowing any kind of linking.
GPL vs non-GPL
There are many arguments for and versus GPL and I think this preference is mostly connected with how close are you to writing commercial applications.
Taking into consideration that open-source developers won’t maintain their software forever and that money is the thing that opens opportunities for big and quality software projects, I suggest going with MIT license if you want your small/medium (non-commercial) library project ever to be used. Or GPL with linking exception if you have open source community that would like to develop it.
As for (non-commercial) applications, MIT is always a good option. Choosing GPL here could be a good idea if you really have open-source community that would be interested in developing it and you want to keep it open-source.
Mixed GPL/LGPL/commercial
There are many libraries out there that offer you a choice:
- GPL or commercial – some companies offer their libraries either on GPL license (for open-source projects) or on commercial license. I guess that’s a good way to make your software known better (in order to sell commercial versions later) and it should work for small or medium libraries. Example: Ext JS.
- GPL or LGPL or commercial – there are libraries out there where you can choose either of those 3 licenses. However offering LGPL means that other companies can use that library for free. This approach could be successful for large projects that can get to be widely used (thanks to LGPL + high quality content) and could also bring money from support, warranties and additional features in commercial licenses. Example: Qt.
“Bypassing” GPL licenses
First LGPL. Don’t try to effectively include LGPL library in your executable (as if statically) by just linking dynamically and then putting it in resources or something. License doesn’t really treat about “-shared” gcc option, but describes that LGPL is effectively GPL with exception of using very small parts of the code (such as headers) to communicate with the library.
Second is GPL (or LGPL). All software derived from another GPL software must be GPL. This won’t change, but that doesn’t mean that a software that’s just using GPL software not as its core can’t be non-GPL or even commercial. This is all about the definition of derived work here. So if you’ll use external GPL application to do some operation for your application – say compile (using GPL gcc) or unzip (LGPL using 7zip), you should be fine, especially if this is just an optional part of your application or you allow user to configure your software to use other replacements. For example Qt Creator does just that by letting you select your compilers (like gcc) in its IDE. You have to make sure your work isn’t effectively derived as in case of, say, writing an executable wrapping all GPL library functions into command-line and then using resulting application through some weird protocol just as you would use the original library. Remember that it’s always treading on thin ice, since this is all about “how much” derived your work is.