Open source software licences: LGPL

Part of the article Open source software licences explained.


What is the LGPL?

The LGPL is a copyleft licence like the GPL, but with a more subtle effect. The main requirement it imposes is roughly: software covered by it may be redistributed under the LGPL or GPL, or else it may be incorporated into software under another licence (such as proprietary software) so long as the LGPL component itself remains under the LGPL and so long as the incorporation is done in a way that allows the user to replace the component if necessary.

In practice the LGPL is almost always used for software libraries rather than applications—LGPL originally stood for “Library General Public License”—and the requirements are usually taken to mean that the library code can be compiled and used in a proprietary application, so long as the library is shipped as a DLL rather than statically linked into the application and the library's (possibly modified) source code is provided.

Like the GPL, there are two widely used versions of the LGPL, LGPLv2.1 and LGPLv3. Unlike the GPL, LGPLv3 is shorter than v2.1 because it is written as an addendum to the GPL instead of as a self-contained licence.


Why would I want to release my code under the LGPL?

If you have written a library that you would like to continue to develop (so you want to ensure modifications are available to you) and that you think is best considered as an individual component, the LGPL might well be an appropriate licence for it.


What are the disadvantages of using the LGPL?

The licence is not all that easy to understand, and uses terminology that make it unsuitable for use with many programming languages or environments—for instance it refers explicitly to header files, libraries, and linking, concepts that don't exist in all environments.

Even though the LGPL is nominally suitable for use in proprietary software, it can be tricky to comply with and many commercial developers will avoid LGPL libraries if a more permissively-licensed alternative is available. (Even if compliance is not technically hard, it involves a degree of coordination between development and distribution functions of a company that might not be easy to achieve.)


How would I apply the LGPL to my own code?

Given the complexity caused by the two incompatible versions of the licence, I would recommend using a “LGPLv2.1 or later” scheme unless you have read both GPLv3 and LGPLv3 and are confident that v3 is more appropriate.

Copy the following text into a header comment at the top of each of your source files:

  Copyright (c) <year> <copyright holders>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  See the file COPYING included with this distribution for more
  information.

Make sure the copyright note has the right year and identifies the correct copyright holders.

Then copy the text of the licence itself into a file named COPYING or COPYING.txt in your source code root directory, and add a reference to it in your README file.

As always, ensure you retain any copyright and licence notes in anyone else's code you have incorporated, and make sure that the licences of such code are compatible with the LGPL.


Return to the article Open source software licences explained, go on to read about other options, or go back to read about the GPL.